You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2002/10/28 19:55:45 UTC

[io] writer/reader sub-packages

The IO lib, if it takes off [and it should] will have lots of Readers,
Writers, InputStreams and OutputStreams.

I'd like to plan these off of the top level in a sub-package. I think it's
obvious that input and output shoudl be separated, but should Stream and
Reader/Writer?

ie) Do I have:

io.input
io.output

or

io.input
io.output
io.reader
io.writer


I'm tempted to go with the former. Any opinions?

Hen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [io] writer/reader sub-packages

Posted by Scott Sanders <sa...@apache.org>.
On Mon, Oct 28, 2002 at 01:55:45PM -0500, Henri Yandell wrote:
> 
> The IO lib, if it takes off [and it should] will have lots of Readers,
> Writers, InputStreams and OutputStreams.
> 
> I'd like to plan these off of the top level in a sub-package. I think it's
> obvious that input and output shoudl be separated, but should Stream and
> Reader/Writer?
> 
> ie) Do I have:
> 
> io.input
> io.output
>

+1
 
> or
> 
> io.input
> io.output
> io.reader
> io.writer
>

+0
 
-- 
Scott Sanders - sanders@apache.org

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [io] writer/reader sub-packages

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Michael Davey" <Mi...@CodeRage.ORG>
> > 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
> (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.

I would be -1 for not supporting InputStream and OutputStream as [io] is not
there to challenge Sun's APIs.

However, [io] can build on Sun's APIs, thus surely it is possible to write a
decorator/new API that does the same job of uniting the input and output
streams?

Stephen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [io] writer/reader sub-packages

Posted by Michael Davey <Mi...@CodeRage.ORG>.
> 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

Re: [io] writer/reader sub-packages

Posted by Henri Yandell <ba...@generationjava.com>.

On Mon, 28 Oct 2002, Michael Davey wrote:

> Henri Yandell wrote:
> > The IO lib, if it takes off [and it should] will have lots of Readers,
> > Writers, InputStreams and OutputStreams.
> >
> > I'd like to plan these off of the top level in a sub-package. I think it's
> > obvious that input and output shoudl be separated, but should Stream and
> > Reader/Writer?
>
> [snip]
>
> Henry,
>
> Take a look at <http://javaxmlstream.sourceforge.net/>.  The use of a
> common IOStream really helps to keep readers and writers balanced, but
> at the cost of being able to implement the DataInput and DataOutput
> interfaces of J2SE.
>
> Probably makes your decision harder.  Sorry.  I'll shutup now. ;)

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 as I think the surprise of
discovering the io classes don't extend Java ones would be a big negative.

Hen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [io] writer/reader sub-packages

Posted by Michael Davey <Mi...@CodeRage.ORG>.
Henri Yandell wrote:
> The IO lib, if it takes off [and it should] will have lots of Readers,
> Writers, InputStreams and OutputStreams.
> 
> I'd like to plan these off of the top level in a sub-package. I think it's
> obvious that input and output shoudl be separated, but should Stream and
> Reader/Writer?

[snip]

Henry,

Take a look at <http://javaxmlstream.sourceforge.net/>.  The use of a 
common IOStream really helps to keep readers and writers balanced, but 
at the cost of being able to implement the DataInput and DataOutput 
interfaces of J2SE.

Probably makes your decision harder.  Sorry.  I'll shutup now. ;)

-- 
Michael