Just trying to keep the reading as simple as possible. However, the while loop seems to return after 1 loop.
try {
final int SIZE = 512;
byte[] buffer = new byte[SIZE];
int bytesRead = 0;
while(inputStream.read(buffer) != -1) {
bytesRead++;
}
jsonString = buffer.toString();
System.out.println("bytesRead: " + bytesRead + " [ " + jsonString + " ]");
}
It should return something like this:
{"errCode":"7500","errDesc":"unknown"}
But when I get printed out is this:
bytesRead: 1 [ [B@5361bf4c ]
Seems it prints out an memory address or just rubbish.
If I use the following:
inputStream.read(buffer, 0, SIZE);
I get the following:
bytesRead: 0 [ [B@53623578 ]
Many thanks for any advice,