class ChunkInputStream extends InputStream implements Seekable {

  @Override
  public synchronized void seek(long pos) throws IOException {
    if (pos < 0 || pos >= length) {
      if (pos == 0) {
        // It is possible for length and pos to be zero in which case
        // seek should return instead of throwing exception
        return;
      }
      throw new EOFException("EOF encountered at pos: " + pos + " for chunk: "
          + chunkInfo.getChunkName());
    }

    if (buffersHavePosition(pos)) {
      // The bufferPosition is w.r.t the current chunk.
      // Adjust the bufferIndex and position to the seeked position.
      adjustBufferPosition(pos - bufferOffset);
    } else {
      chunkPosition = pos;
    }
  }

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

}