CompactList implements Iterable<MutableDirectBuffer>, CloseableSilently { public int copyInto(final MutableDirectBuffer dstBuffer, final int offset) { final int length = listBuffer.capacity(); dstBuffer.putBytes(offset, listBuffer, 0, length); return length; } CompactList(
      final int elementMaxLength, final int capacity, final BufferAllocator bufferAllocator);  CompactList(
      final AllocatedBuffer allocatedBuffer, final int elementMaxLength, final int capacity);  CompactList(final UnsafeBuffer listBuffer); void add(final DirectBuffer srcBuffer); void add(final DirectBuffer srcBuffer, final int offset, final int length); void add(final DirectBuffer srcBuffer, final int offset, final int length, final int idx); void set(final int idx, final DirectBuffer srcBuffer); void set(final int idx, final DirectBuffer srcBuffer, final int offset, final int length); void remove(final int idx); int size(); int sizeVolatile(); int capacity(); int maxElementDataLength(); int get(final int idx, final MutableDirectBuffer dstBuffer, final int offset); int wrap(final int idx, final MutableDirectBuffer dstBuffer); int getEncodedSize(); DirectBuffer getRawBuffer(); int find(final DirectBuffer key, final Comparator<DirectBuffer> c); int copyInto(final MutableDirectBuffer dstBuffer, final int offset); void clear(); @Override CompactListIterator iterator(); InputStream toInputStream(); @Override void close();  }
@Test public void shouldCopyInto() { addValues(); final int framedElementLength = framedLength(SIZE_OF_INT); final UnsafeBuffer copy = new UnsafeBuffer(new byte[requiredBufferCapacity(framedElementLength, 16)]); list.copyInto(copy, 0); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 0)))).isEqualTo(0); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 1)))).isEqualTo(1); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 2)))).isEqualTo(2); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 3)))).isEqualTo(3); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 4)))).isEqualTo(4); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 5)))).isEqualTo(5); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 6)))).isEqualTo(6); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 7)))).isEqualTo(7); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 8)))).isEqualTo(8); assertThat(copy.getInt(elementDataOffset(elementOffset(framedElementLength, 9)))).isEqualTo(9); }
@Test public void shouldReturnLengthOfCopy() { addValues(); final int framedElementLength = framedLength(SIZE_OF_INT); final UnsafeBuffer copy = new UnsafeBuffer(new byte[requiredBufferCapacity(framedElementLength, 16)]); final int length = list.copyInto(copy, 0); assertThat(length).isEqualTo(140); }