@Override
  public long skip(long n) throws IOException {
    if (n <= 0) {
      return 0;
    }
    long toBeSkipped = Math.min(n, mLength - mPosition);
    if (!mUfsInStream.isPresent()) {
      mPosition += toBeSkipped;
      return toBeSkipped;
    }
    long skipped = mUfsInStream.get().skip(toBeSkipped);
    if (skipped > 0) {
      mPosition += skipped;
    }
    return skipped;
  }
@Test
  public void skip() throws IOException, AlluxioException {
    AlluxioURI ufsPath = getUfsPath();
    createFile(ufsPath, CHUNK_SIZE);
    Random random = new Random();
    try (FileInStream inStream = getStream(ufsPath)) {
      for (int i = 0; i < 10; i++) {
        if (inStream.remaining() <= 0) {
          break;
        }
        int skip = random.nextInt((int) inStream.remaining());
        assertEquals(skip, inStream.skip(skip));
        assertEquals(skip, inStream.getPos());
        int len = CHUNK_SIZE - skip;
        byte[] res = new byte[len];
        assertEquals(len,
            inStream.read(res, 0, len));
        assertTrue(BufferUtils.equalIncreasingByteArray(skip, len, res));
      }
    }
  }