Showing posts with label inputstream. Show all posts
Showing posts with label inputstream. Show all posts

Wednesday, May 27, 2009

Convert an input String to InputStream

We can use java.io.ByteArrayInputStream and use string.getBytes() like this

String input = "Input Stream";
try {
ByteArrayInputStream ba = new ByteArrayInputStream(input.getBytes());

// TODO Codes //
// ...
// ...
//

} catch (Exception e) {
e.printStackTrace();
}
Somebody use this solution for parser xml ^^, have a fun !!!