Quantcast
Channel: Random Developer
Viewing all articles
Browse latest Browse all 8

String to an Input Stream

$
0
0

Recently I came across an issue in java where xml data retrieved from a database. The returned string needs to be converted into an input stream to be useful in the program.

The following is a solution I used; you may find it useful. I have used UTF-8 encoding as it was required for my case, altername as required.

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

Viewing all articles
Browse latest Browse all 8

Trending Articles