/** * Creates a new under storage file input stream. * * @param initPos the initial position * @param length the length * @param ufsPath the under file system path * @throws IOException if an I/O error occurs */ public UnderStoreFileInStream(long initPos, long length, String ufsPath) throws IOException { mInitPos = initPos; mLength = length; mUfsPath = ufsPath; setUnderStoreStream(initPos); }
@Override public void seek(long pos) throws IOException { long offset = mPos - mInitPos; if (pos < offset) { setUnderStoreStream(pos); } else { long toSkip = pos - offset; if (skip(toSkip) != toSkip) { throw new IOException("Failed to seek forward to " + pos); } } }