blackberry - How do I send an EOF for a Java InputStream element? -
Then I have the code to open an input stream and successfully collect the information:
HttpInput = httpConnection.openInputStream (); Sb = new stringbuffer (); While (ch! = -1) {ch = httpInput.read (); Sb.append ((four) ch); }
However, when I try to use the same string (sb.toString ()) in another method, then let me say "end of expectation of file" Get the error. So how do I add an EOF character to my string? Note: The response is basically an XML document coming from a remote server.
So when the code reaches the "pars" line, then gives me an error above:
bis = new ByteArrayInputStream (sb.toString () getBytes ().); Doc = docBuilder.parse (bis);
I am coding for a Blackberry app.
AC
If you want to read the stream in the byte array, / P>
Comments
Post a Comment