/** * {@inheritDoc} */ @Override public int read(final byte[] b, final int off, final int len) throws IOException { if (endReached) { return -1; } switch (state) { case NO_BLOCK: fill(); return read(b, off, len); case IN_LITERAL: int litLen = readLiteral(b, off, len); if (!hasMoreDataInBlock()) { state = State.NO_BLOCK; } return litLen > 0 ? litLen : read(b, off, len); case IN_BACK_REFERENCE: int backReferenceLen = readBackReference(b, off, len); if (!hasMoreDataInBlock()) { state = State.NO_BLOCK; } return backReferenceLen > 0 ? backReferenceLen : read(b, off, len); default: throw new IOException("Unknown stream state " + state); } }
/** * {@inheritDoc} */ @Override public int read(final byte[] b, final int off, final int len) throws IOException { if (endReached) { return -1; } switch (state) { case NO_BLOCK: fill(); return read(b, off, len); case IN_LITERAL: int litLen = readLiteral(b, off, len); if (!hasMoreDataInBlock()) { state = State.NO_BLOCK; } return litLen > 0 ? litLen : read(b, off, len); case IN_BACK_REFERENCE: int backReferenceLen = readBackReference(b, off, len); if (!hasMoreDataInBlock()) { state = State.NO_BLOCK; } return backReferenceLen > 0 ? backReferenceLen : read(b, off, len); default: throw new IOException("Unknown stream state " + state); } }