so I have the following code that opens an input stream and collects information successfully:
httpInput = httpConnection.openInputStream();
sb= new StringBuffer();
while (ch != -1)
{
ch = httpInput.read();
sb.append((char)ch);
}
however, when I try to use the same line (sb.toString ()) in another method, I get an error "Waiting for end of file". so how can i bind the EOF character to my string? NOTE. The answer is basically an XML document coming from a remote server.
so when the code reaches the string "parse", it gives me the error above:
bis = new ByteArrayInputStream (sb.toString (). getBytes ()); doc = docBuilder.parse (bis);
I code this for a blackberry application.
ace
source
share