@Override public long length() throws IOException { ensureNotClosed(); return segmentLen; }
@Override public long position() throws IOException { ensureNotClosed(); return relativePos; }
@Override public long length() throws IOException { ensureNotClosed(); return segmentLen; }
@Override public long position() throws IOException { ensureNotClosed(); return relativePos; }
@Override public long length() throws IOException { ensureNotClosed(); return segmentLen; }
@Override public long position() throws IOException { ensureNotClosed(); return relativePos; }
public long skip( final long n ) throws IOException { ensureNotClosed(); if ( eofInBlock() ) return 0; long effectiveskip = Math.max( Math.min( segmentLen - relativePos, n ), 0 ); effectiveskip = in.skip( effectiveskip ); relativePos += effectiveskip; return effectiveskip; }
@Override public long skip(final long n) throws IOException { ensureNotClosed(); if (eofInBlock()) return 0; long effectiveskip = Math.max(Math.min(segmentLen - relativePos, n), 0); effectiveskip = in.skip(effectiveskip); relativePos += effectiveskip; return effectiveskip; }
public int read() throws IOException { ensureNotClosed(); if ( eofInBlock() ) return -1; final int r = in.read(); relativePos++; return r; }
/** Checks if the current position is a stop marker. * * @return false if a skip has to be done or eof has been reached, true otherwise. */ private boolean eofInBlock() { ensureBlocksNotEmpty(); ensureNotClosed(); return relativePos >= segmentLen; }
public int read() throws IOException { ensureNotClosed(); if ( eofInBlock() ) return -1; final int r = in.read(); relativePos++; return r; }
/** Moves into the next segment of the current block. */ public void reset() throws IOException { ensureNotClosed(); nextSegment(); } }
public int available() throws IOException { ensureNotClosed(); if ( eofInBlock() ) return 0; return Math.min( in.available(), segmentLen - relativePos ); }
@Override public int read() throws IOException { ensureNotClosed(); if (eofInBlock()) return -1; final int r = in.read(); relativePos++; return r; }
public long skip( final long n ) throws IOException { ensureNotClosed(); if ( eofInBlock() ) return 0; long effectiveskip = Math.max( Math.min( segmentLen - relativePos, n ), 0 ); effectiveskip = in.skip( effectiveskip ); relativePos += effectiveskip; return effectiveskip; }
/** Checks if the current position is a stop marker. * * @return false if a skip has to be done or eof has been reached, true otherwise. */ private boolean eofInBlock() { ensureBlocksNotEmpty(); ensureNotClosed(); return relativePos >= segmentLen; }
@Override public int available() throws IOException { ensureNotClosed(); if (eofInBlock()) return 0; return Math.min(in.available(), segmentLen - relativePos); }
/** Moves into the next segment of the current block. */ @Override public void reset() throws IOException { ensureNotClosed(); nextSegment(); } }
public int read( final byte b[], final int off, final int len ) throws IOException { ensureNotClosed(); ByteArrays.ensureOffsetLength( b, off, len ); if ( len == 0 ) return 0; // Requested by InputStream. if ( eofInBlock() ) return -1; int effectivelen = Math.min( segmentLen - relativePos, len ); effectivelen = in.read( b, off, effectivelen ); relativePos += effectivelen; return effectivelen; }
@Override public int read(final byte b[], final int off, final int len) throws IOException { ensureNotClosed(); ByteArrays.ensureOffsetLength(b, off, len); if (len == 0) return 0; // Requested by InputStream. if (eofInBlock()) return -1; int effectivelen = Math.min(segmentLen - relativePos, len); effectivelen = in.read(b, off, effectivelen); relativePos += effectivelen; return effectivelen; }