Number bytes read from TInputStream

Hi

When reading from a TInputStream I was surprised to see how few bytes that were delivered by a read operation (see code below).

Although a buffer of 100000 chars is provided, the read operation returns only something like 1-3 kB.

How come?
Could this behaviour be affected?


Cheers,

Hokan

// TStreamAccessor sAccessor;
char cbuf = new char[100000];
TInputStream resultStream = sAccessor.query(TQuery.newInstance("/MyDoc"));
InputStreamReader isr = new InputStreamReader(resultStream, “UTF8”);
int nbChars = isr.read(cbuf);

I suspect that this is related to the response being of indeterminate length. This means that it is sent as a chunked transfer. Typically these chunks are 8K or less.

I think that you should continue reading until end of stream.