Bob Tanner <tanner at real-time.com> writes: > Quoting Bob Tanner (tanner at real-time.com): > > 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. > > > > I guess I should talking about what I want to do. > > I have a String of that represents a set of java.util.Properties, I want to > load(InputStream) the Properties class from the String. > > String I create a StringReader and need to get some sort of InputStream so I can > pass it to the load() method. > 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. I suppose you could write one too: public class MyInputStream extends InputStream { public MyInputStream(final Reader delegate) { _delegate = delegate; } private Reader _delegate; public int read() { return _delegate.read(); } } -- Jon Schewe | http://mtu.net/~jpschewe | jpschewe at mtu.net For I am convinced that neither death nor life, neither angels nor demons, neither the present nor the future, nor any powers, neither height nor depth, nor anything else in all creation, will be able to separate us from the love of God that is in Christ Jesus our Lord. - Romans 8:38-39