Quantcast
Channel: How do I turn a String into a InputStreamReader in java? - Stack Overflow
Browsing latest articles
Browse All 7 View Live

Answer by yegor256 for How do I turn a String into a InputStreamReader in java?

You can try Cactoos:InputStream stream = new InputStreamOf(str);Then, if you need a Reader:Reader reader = new ReaderOf(stream);

View Article



Answer by Fai Ng for How do I turn a String into a InputStreamReader in java?

Are you trying to get a) Reader functionality out of InputStreamReader, or b) InputStream functionality out of InputStreamReader? You won't get b). InputStreamReader is not an InputStream.The purpose...

View Article

Answer by Yossale for How do I turn a String into a InputStreamReader in java?

I also found the apache commons IOUtils class , so : InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(myString));

View Article

Answer by toolkit for How do I turn a String into a InputStreamReader in java?

Same question as @Dan - why not StringReader ?If it has to be InputStreamReader, then:String charset = ...; // your charsetbyte[] bytes = string.getBytes(charset);ByteArrayInputStream bais = new...

View Article

Answer by Guido for How do I turn a String into a InputStreamReader in java?

ByteArrayInputStream also does the trick:InputStream is = new ByteArrayInputStream( myString.getBytes( charset ) );Then convert to reader:InputStreamReader reader = new InputStreamReader(is);

View Article


Answer by Dan Dyer for How do I turn a String into a InputStreamReader in java?

Does it have to be specifically an InputStreamReader? How about using StringReader?Otherwise, you could use StringBufferInputStream, but it's deprecated because of character conversion issues (which is...

View Article

How do I turn a String into a InputStreamReader in java?

How can I transform a String value into an InputStreamReader?

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images