code: public int read(ByteBuffer toFill) {
          int originalPos = toFill.position();
          while (dataAvailable() > 0 && toFill.hasRemaining()) {
              readHelper(toFill);
          }
          return toFill.position() - originalPos;
      }
docs: Copies into the given ByteBuffer.
  
  @param toFill The ByteBuffer to fill into.
  @return the number of bytes put into toFill