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 !!!


No comments:

Post a Comment