code: public void read(InputStream in, int lengthToRead) throws IOException {
      int read = 0;
      do {
        grow(length);
        read = data.setBytes(length, in, Math.min(lengthToRead, data.length() - length));
        length += read;
        lengthToRead -= read;
      } while (lengthToRead > 0);
    }
docs: Read lengthToRead bytes from the input stream into this array
  @param in the stream to read from
  @param lengthToRead the number of bytes to read
  @throws IOException