i know you can convert InputStream
to string using something like :
public static String convertStreamToString(ServletInputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
Which is fine, however my input stream is an xml I parse using SAX Parser, and I was wondering if there is an faster way to get the XML as string, since the parser already loops through the stream.
I can get it to work by concating the string in all the events,but I was wondering if there's a faster/built in way to do so, since this code is really performance-sensitive