@Override
    public int read() throws IOException {
      if (chunk == null || !readUntil(pos)) return -1;

      while (pos > chunk.lastIndex()) {
        chunk = chunk.next;
      }
      return chunk.get(pos++);
    }
 @Override
 public int read() throws IOException {
   int curpos = pos;
   if (readUntil(curpos)) return lastChunk.get(curpos);
   return -1;
 }