code: public Buffer copyTo(Buffer out, long offset, long byteCount) {
      if (out == null) throw new IllegalArgumentException("out == null");
      checkOffsetAndCount(size, offset, byteCount);
      if (byteCount == 0) return this;
  
      out.size += byteCount;
  
      // 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 one segment at a time.
      for (; byteCount > 0; s = s.next) {
        Segment copy = new Segment(s);
        copy.pos += offset;
        copy.limit = Math.min(copy.pos + (int) byteCount, copy.limit);
        if (out.head == null) {
          out.head = copy.next = copy.prev = copy;
        } else {
          out.head.prev.push(copy);
        }
        byteCount -= copy.limit - copy.pos;
        offset = 0;
      }
  
      return this;
    }
docs: Copy {@code byteCount} bytes from this, starting at {@code offset}, to {@code out}.