Bob Tanner wrote:
> How can I get a StringReader into a class that is part of the
> InputStream hierarchy?
> 
> I use to use the StringBufferInputStream, but that is deprecated.

Quoting Jon Schewe (jpschewe at mtu.net):
> How about using java.io.ByteArrayInputStream?  I do find it
> irritating that there isn't a way to get from Reader to InputStream,
> but there is a way to get from InputStream to Reader,
> java.io.InputStreamReader.

Bob Tanner wrote:
> I ended up using the ByteArrayInputStream. :-(

I looked at the methods and properties of java.util.Properties and the
respective Readers and InputStreams.  It seems that the biggest
difference between the Reader and InputStream interfaces is that the
Reder stream calls read with a character array parameter, and the
InputStream calls read with a byte array parameter.

It might be possible to create a concrete class ReaderInputStream that
extends the InputStream interface and accepts a Reader object as it's
parameter.  You don't have to be as careful about converting from
char[] to byte[] as you do the other way around, so converting the
read() methods shouldn't be too much work.

-- 
Chad Walstrom <chewie at wookimus.net>                 | a.k.a. ^chewie
http://www.wookimus.net/                            | s.k.a. gunnarr
Key fingerprint = B4AB D627 9CBD 687E 7A31  1950 0CC7 0B18 206C 5AFD

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-devel/attachments/20010411/de371f92/attachment.pgp