public static final String ENCODING = "UTF8"; // see note
public static InputStream fromString(String str) {
byte[] bytes = str.getBytes(ENCODING);
return new ByteArrayInputStream(bytes);
}
Note : List of supported encodings here
Written and compiled by Réal Gagnon ©1998-2012
[ home ]