commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Davey <Michael.Da...@CodeRage.ORG>
Subject Re: [io] writer/reader sub-packages
Date Mon, 28 Oct 2002 20:21:30 GMT

> Took a while to get the idea into my head. Think I understand you now.
> 
> [for the sake of the list]:
> 
> The lib you mention has a unified Stream which has both the reading and
> writing parts in [summarising a touch]. This is nice except that it means
> that 'XmlReadStream' does not extend java.io.InputStream. It'd be nice to
> hear some good positives for the joined version

Allows you to do things like:

   void write( OutputStream out ) {
       out.asFoo( this );
   }

   void read( InputStream in ) {
       in.asFoo( this );
   }

   /* balanced read/write */
   void asFoo( IOStream stream ) {
       objA = stream.asFoo( objA );
       objB = stream.asFoo( objB );
   }

...as I said before, it forces the raeder and writer to be balanced 
(that is, it is unlikely that an inteligent programmer will accidentally 
code asFoo() in such a way that read() fails to read the data written by 
write()).

> as I think the surprise of
> discovering the io classes don't extend Java ones would be a big negative.

Agreed.  I'm not sure the positives outweigh the negative either.

-- 
Michael

Mime
View raw message