@Override public int read(final byte[] pBytes, final int pOffset, final int pLength) throws IOException { if (bytesLeft <= 0) { return -1; } int read = super.read(pBytes, pOffset, (int) findMaxLen(pLength)); bytesLeft = read < 0 ? 0 : bytesLeft - read; return read; }
@Override public final int read(byte[] pBytes) throws IOException { return read(pBytes, 0, pBytes.length); }
/** * Marks this stream as closed. * This implementation does <em>not</em> close the underlying stream. */ @Override public void close() throws IOException { // NOTE: Do not close the underlying stream while (bytesLeft > 0) { //noinspection ResultOfMethodCallIgnored skip(bytesLeft); } }
@Override public long skip(long pLength) throws IOException { long skipped = super.skip(findMaxLen(pLength));// Skips 0 or more, never -1 bytesLeft -= skipped; return skipped; } }
/** * Marks this stream as closed. * This implementation does <em>not</em> close the underlying stream. */ @Override public void close() throws IOException { // NOTE: Do not close the underlying stream while (mLeft > 0) { //noinspection ResultOfMethodCallIgnored skip(mLeft); } }
@Override public final int read(byte[] pBytes) throws IOException { return read(pBytes, 0, pBytes.length); }
@Override public int read(final byte[] pBytes, final int pOffset, final int pLength) throws IOException { if (bytesLeft <= 0) { return -1; } int read = super.read(pBytes, pOffset, (int) findMaxLen(pLength)); bytesLeft = read < 0 ? 0 : bytesLeft - read; return read; }
/** * Marks this stream as closed. * This implementation does <em>not</em> close the underlying stream. */ @Override public void close() throws IOException { // NOTE: Do not close the underlying stream while (bytesLeft > 0) { //noinspection ResultOfMethodCallIgnored skip(bytesLeft); } }
@Override public final int read(byte[] pBytes) throws IOException { return read(pBytes, 0, pBytes.length); }
@Override public int read(final byte[] pBytes, final int pOffset, final int pLength) throws IOException { if (mLeft <= 0) { return -1; } int read = super.read(pBytes, pOffset, (int) findMaxLen(pLength)); mLeft = read < 0 ? 0 : mLeft - read; return read; }
@Override public long skip(long pLength) throws IOException { long skipped = super.skip(findMaxLen(pLength));// Skips 0 or more, never -1 bytesLeft -= skipped; return skipped; } }
@Override public long skip(long pLength) throws IOException { long skipped = super.skip(findMaxLen(pLength));// Skips 0 or more, never -1 mLeft -= skipped; return skipped; } }