code: public Buffer copyTo(OutputStream out, long offset, long byteCount) throws IOException {
      if (out == null) throw new IllegalArgumentException("out == null");
      checkOffsetAndCount(size, offset, byteCount);
      if (byteCount == 0) return this;
  
      // Skip segments that we aren't copying from.
      Segment s = head;
      for (; offset >= (s.limit - s.pos); s = s.next) {
        offset -= (s.limit - s.pos);
      }
  
      // Copy from one segment at a time.
      for (; byteCount > 0; s = s.next) {
        int pos = (int) (s.pos + offset);
        int toCopy = (int) Math.min(s.limit - pos, byteCount);
        out.write(s.data, pos, toCopy);
        byteCount -= toCopy;
        offset = 0;
      }
  
      return this;
    }
docs: Copy {@code byteCount} bytes from this, starting at {@code offset}, to
  {@code out}.