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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleHow do I turn a String into a InputStreamReader in java?
How can I transform a String value into an InputStreamReader?
View Article
More Pages to Explore .....