AbstractInput: multiple EOF values in getNextBuffer()

Issue #76 resolved
Laurent Bihanic
created an issue

AbstractInput.getNextBuffer() returns 0 or -1 (Input.EOF) when the end of file has been reached but the other methods of AbstractInput (readUnsignedByte, readSignedShort...) only check for EOF, never 0.

In some cases, this leads to java.nio.BufferUnderflowExceptions being thrown.

Fix proposal: change getNextBuffer() contract to only return EOF when the end of buffer has been reached. {{{ if (this.buffer != null && this.channel != null) { ... } return EOF; }}}

Comments (5)

  1. Log in to comment