@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 manyBytesReadByteBuffer() throws IOException, AlluxioException {
    AlluxioURI ufsPath = getUfsPath();
    createFile(ufsPath, CHUNK_SIZE);
    ByteBuffer buffer = ByteBuffer.allocate(CHUNK_SIZE);
    try (FileInStream inStream = getStream(ufsPath)) {
      assertEquals(CHUNK_SIZE, inStream.read(buffer));
      assertTrue(BufferUtils.equalIncreasingByteBuffer(0, CHUNK_SIZE, buffer));
    }
  }