class ChunkInputStream extends InputStream implements Seekable {

  @Override
  public synchronized int read() throws IOException {
    checkOpen();
    int available = prepareRead(1);
    int dataout = EOF;

    if (available == EOF) {
      // There is no more data in the chunk stream. The buffers should have
      // been released by now
      Preconditions.checkState(buffers == null);
    } else {
      dataout = Byte.toUnsignedInt(buffers.get(bufferIndex).get());
    }

    if (chunkStreamEOF()) {
      // consumer might use getPos to determine EOF,
      // so release buffers when serving the last byte of data
      releaseBuffers();
    }

    return dataout;
  }

    ChunkInputStream(ChunkInfo chunkInfo, BlockID blockId,
          XceiverClientSpi xceiverClient, boolean verifyChecksum);

}