Merge pull request #63 from bokken/develop
Read until all bytes needed are read or EOF
This commit is contained in:
commit
50619d3f9d
|
@ -136,9 +136,7 @@ public final class SnappyFramedInputStream extends InputStream implements
|
||||||
final byte[] actualHeader = new byte[expectedHeader.length];
|
final byte[] actualHeader = new byte[expectedHeader.length];
|
||||||
final ByteBuffer actualBuffer = ByteBuffer.wrap(actualHeader);
|
final ByteBuffer actualBuffer = ByteBuffer.wrap(actualHeader);
|
||||||
|
|
||||||
// assume that if the input cannot read 4 bytes that something is
|
final int read = SnappyFramed.readBytes(in, actualBuffer);
|
||||||
// wrong.
|
|
||||||
final int read = in.read(actualBuffer);
|
|
||||||
if (read < expectedHeader.length) {
|
if (read < expectedHeader.length) {
|
||||||
throw new EOFException(
|
throw new EOFException(
|
||||||
"encountered EOF while reading stream header");
|
"encountered EOF while reading stream header");
|
||||||
|
|
Loading…
Reference in New Issue