public ByteBuffer copy() {
      byte[] copy = new byte[length];
      if (length > 0) {
        System.arraycopy(bytes, (int)offset, copy, 0, length);
      }
      return ByteBuffer.wrap(copy);
    }
The class representing a segment of bytes in the buffer. Can either be a reference
to a segment of the whole WriteBuffers (when bytes is not set), or to a segment of
some byte array (when bytes is set).
serde/src/java/org/apache/hadoop/hive/serde2/WriteBuffers.java