Does you inputstream code look similar to the following partial listing?
HttpConnection http = null;
InputStream iStrm = null;
...
// Create the connection
http = (HttpConnection) Connector.open(url);
...
iStrm = http.openInputStream();
int length = (int) http.getLength();
if (length != -1)
{
// Read data in one chunk
byte serverData[] = new byte[length];
iStrm.read(serverData);
str = new
String(serverData);
}
else // Length not available...
{
ByteArrayOutputStream bStrm =
new ByteArrayOutputStream();
// Read data one character at a time
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
str = new String(bStrm.toByteArray());
bStrm.close();
}
John Muchow
Author of :
Core J2ME Technology and MIDP