Quantcast
Channel: Johan Känngård » Java
Viewing all articles
Browse latest Browse all 9

String to InputStream

$
0
0

Arguments in many methods in the Java APIs are of the type InputStream. This is how to get an InputStream from a String, where argument to getBytes, UTF-8, is the encoding to use:

InputStream is = new ByteArrayInputStream(myString.getBytes(\"UTF-8\"));

[tags]Java[/tags]


Viewing all articles
Browse latest Browse all 9

Trending Articles