// read contents from the stream
byte[] cbuf = new byte[this.chunkSize];
int read = this.stream.read(cbuf);
if (read == -1) {
return new LobChunk(new byte[0], true);
}
boolean isLast = false;
if (read != this.chunkSize) {
byte[] buf = new byte[read];
System.arraycopy(cbuf, 0, buf, 0, read);
cbuf = buf;
}
int next = this.stream.read();
if (next == -1) {
isLast = true;
} else {
this.stream.unread(next);
}
return new LobChunk(cbuf, isLast);
}