Java/String to InputStream

Un article de Le wiki de 2 noisettes - noisette.ch.


String to InputStream

Arguments in many methods in the Java APIs are of the type InputStream. This is how to get an InputStream from a String:

InputStream is = new ByteArrayInputStream(myString.getBytes());