@Override
  public int read() throws IOException {
    if (mPosition == mLength) { // at end of file
      return -1;
    }
    updateStreamIfNeeded();
    int res = mUfsInStream.get().read();
    if (res == -1) {
      return -1;
    }
    mPosition++;
    Metrics.BYTES_READ_FROM_UFS.inc(1);
    return res;
  }
@Test
  public void readOffsetByteBuffer() throws IOException, AlluxioException {
    AlluxioURI ufsPath = getUfsPath();
    createFile(ufsPath, CHUNK_SIZE); // 100
    int start = CHUNK_SIZE / 4; // 25
    int len = CHUNK_SIZE / 2; // 75
    try (FileInStream inStream = getStream(ufsPath)) {
      ByteBuffer buffer = ByteBuffer.allocate(CHUNK_SIZE);
      buffer.position(start);
      assertEquals(CHUNK_SIZE / 2, inStream.read(buffer, start, len));
      for (int i = start; i < start + len; i++) {
        assertEquals(i - start, buffer.get(i));
      }
    }
  }