BufferUtil { public static DirectBuffer cloneBuffer(final DirectBuffer src) { return cloneBuffer(src, 0, src.capacity()); } private  BufferUtil(); static String bufferAsString(final DirectBuffer buffer); static String bufferAsString(
      final DirectBuffer buffer, final int offset, final int length); static DirectBuffer wrapString(final String argument); static boolean equals(final DirectBuffer buffer1, final DirectBuffer buffer2); static boolean contentsEqual(final DirectBuffer buffer1, final DirectBuffer buffer2); static DirectBuffer cloneBuffer(final DirectBuffer src); static DirectBuffer cloneBuffer(
      final DirectBuffer src, final int offset, final int length); static String bufferAsHexString(final BufferWriter writer); static String bufferAsHexString(final BufferWriter writer, final int wrap); static String bufferAsHexString(final DirectBuffer buffer); static String bufferAsHexString(final DirectBuffer buffer, final int wrap); static String bufferAsHexString(
      final DirectBuffer buffer, final int offset, final int length); static String bufferAsHexString(
      final DirectBuffer buffer, final int offset, final int length, final int wrap); static String bytesAsHexString(final byte[] bytes); static String bytesAsHexString(final byte[] bytes, final int wrap); static byte[] bufferAsArray(final DirectBuffer buffer); static MutableDirectBuffer wrapArray(final byte[] array); static MutableDirectBuffer wrapBytes(final int... bytes); static int bufferContentsHash(final DirectBuffer buffer); static boolean startsWith(
      final byte[] prefix,
      final int prefixOffset,
      final int prefixLength,
      final byte[] content,
      int contentOffset,
      final int contentLength); static final int NO_WRAP; static final int DEFAULT_WRAP; }
@Test public void testCloneUnsafeBuffer() { final DirectBuffer src = new UnsafeBuffer(BYTES1); final DirectBuffer dst = cloneBuffer(src); assertThat(dst).isNotSameAs(src).isEqualTo(src).hasSameClassAs(src); }
@Test public void testCloneExpandableArrayBuffer() { final MutableDirectBuffer src = new ExpandableArrayBuffer(BYTES1.length); src.putBytes(0, BYTES1); final DirectBuffer dst = cloneBuffer(src); assertThat(dst).isNotSameAs(src).isEqualTo(src).hasSameClassAs(src); }