code: Segment writableSegment(int minimumCapacity) {
      if (minimumCapacity < 1 || minimumCapacity > Segment.SIZE) throw new IllegalArgumentException();
  
      if (head == null) {
        head = SegmentPool.take(); // Acquire a first segment.
        return head.next = head.prev = head;
      }
  
      Segment tail = head.prev;
      if (tail.limit + minimumCapacity > Segment.SIZE || !tail.owner) {
        tail = tail.push(SegmentPool.take()); // Append a new empty segment to fill up.
      }
      return tail;
    }
docs: Returns a tail segment that we can write at least {@code minimumCapacity}
  bytes to, creating it if necessary.