@Test public void testGetCurrentArrayPosition() { CompositeReadableBuffer buffer = new CompositeReadableBuffer(); byte[] source1 = new byte[] { 0, 1, 2 }; byte[] source2 = new byte[] { 3, 4, 5, 6 }; byte[] source3 = new byte[] { 7, 8, 9, 10, 11 }; assertEquals(0, buffer.getCurrentArrayPosition()); buffer.append(source1); assertEquals(0, buffer.getCurrentArrayPosition()); buffer.append(source2); assertEquals(0, buffer.getCurrentArrayPosition()); buffer.append(source3); assertEquals(0, buffer.getCurrentArrayPosition()); assertEquals(0, buffer.getCurrentIndex()); assertFalse(buffer.hasArray()); assertEquals(3, buffer.getArrays().size()); assertEquals(0, buffer.getCurrentArrayPosition()); assertEquals(12, buffer.limit()); assertEquals(12, buffer.capacity()); for(int i = 0; i < source1.length; i++) { assertEquals(i, buffer.getCurrentArrayPosition()); assertEquals(i, buffer.get()); } assertEquals(0, buffer.getCurrentArrayPosition()); assertEquals(1, buffer.getCurrentIndex()); assertFalse(buffer.hasArray()); assertEquals(3, buffer.getArrays().size()); assertEquals(12, buffer.limit()); assertEquals(12, buffer.capacity()); for(int i = 0; i < source2.length; i++) { assertEquals(i, buffer.getCurrentArrayPosition()); assertEquals(i + source1.length, buffer.get()); } assertEquals(0, buffer.getCurrentArrayPosition()); assertEquals(2, buffer.getCurrentIndex()); assertFalse(buffer.hasArray()); assertEquals(3, buffer.getArrays().size()); assertEquals(12, buffer.limit()); assertEquals(12, buffer.capacity()); for(int i = 0; i < source3.length; i++) { assertEquals(i, buffer.getCurrentArrayPosition()); assertEquals(i + source1.length + source2.length, buffer.get()); } assertEquals(source3.length, buffer.getCurrentArrayPosition()); assertEquals(2, buffer.getCurrentIndex()); }
public int getCurrentArrayPosition() { return currentOffset; }
CompositeReadableBuffer implements ReadableBuffer { public int getCurrentArrayPosition() { return currentOffset; } }
CompositeReadableBuffer implements ReadableBuffer { public int getCurrentArrayPosition() { return currentOffset; } CompositeReadableBuffer(); private  CompositeReadableBuffer(byte[] array, int offset); private  CompositeReadableBuffer(boolean compactable); }
CompositeReadableBuffer implements ReadableBuffer { public int getCurrentArrayPosition() { return currentOffset; } CompositeReadableBuffer(); private  CompositeReadableBuffer(byte[] array, int offset); private  CompositeReadableBuffer(boolean compactable); List<byte[]> getArrays(); int getCurrentIndex(); int getCurrentArrayPosition(); @Override boolean hasArray(); @Override int capacity(); @Override byte[] array(); @Override int arrayOffset(); @Override byte get(); @Override byte get(int index); @Override int getInt(); @Override long getLong(); @Override short getShort(); @Override float getFloat(); @Override double getDouble(); @Override CompositeReadableBuffer get(byte[] data); @Override CompositeReadableBuffer get(byte[] data, int offset, int length); @Override CompositeReadableBuffer get(WritableBuffer target); @Override CompositeReadableBuffer position(int position); @Override int position(); @Override CompositeReadableBuffer slice(); @Override CompositeReadableBuffer flip(); @Override CompositeReadableBuffer limit(int limit); @Override int limit(); @Override CompositeReadableBuffer mark(); @Override CompositeReadableBuffer reset(); @Override CompositeReadableBuffer rewind(); @Override CompositeReadableBuffer clear(); @Override int remaining(); @Override boolean hasRemaining(); @Override CompositeReadableBuffer duplicate(); @Override ByteBuffer byteBuffer(); @Override String readUTF8(); @Override String readString(CharsetDecoder decoder); @Override CompositeReadableBuffer reclaimRead(); CompositeReadableBuffer append(byte[] array); CompositeReadableBuffer append(CompositeReadableBuffer buffer); CompositeReadableBuffer append(ReadableBuffer buffer); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); }
CompositeReadableBuffer implements ReadableBuffer { public int getCurrentArrayPosition() { return currentOffset; } CompositeReadableBuffer(); private  CompositeReadableBuffer(byte[] array, int offset); private  CompositeReadableBuffer(boolean compactable); List<byte[]> getArrays(); int getCurrentIndex(); int getCurrentArrayPosition(); @Override boolean hasArray(); @Override int capacity(); @Override byte[] array(); @Override int arrayOffset(); @Override byte get(); @Override byte get(int index); @Override int getInt(); @Override long getLong(); @Override short getShort(); @Override float getFloat(); @Override double getDouble(); @Override CompositeReadableBuffer get(byte[] data); @Override CompositeReadableBuffer get(byte[] data, int offset, int length); @Override CompositeReadableBuffer get(WritableBuffer target); @Override CompositeReadableBuffer position(int position); @Override int position(); @Override CompositeReadableBuffer slice(); @Override CompositeReadableBuffer flip(); @Override CompositeReadableBuffer limit(int limit); @Override int limit(); @Override CompositeReadableBuffer mark(); @Override CompositeReadableBuffer reset(); @Override CompositeReadableBuffer rewind(); @Override CompositeReadableBuffer clear(); @Override int remaining(); @Override boolean hasRemaining(); @Override CompositeReadableBuffer duplicate(); @Override ByteBuffer byteBuffer(); @Override String readUTF8(); @Override String readString(CharsetDecoder decoder); @Override CompositeReadableBuffer reclaimRead(); CompositeReadableBuffer append(byte[] array); CompositeReadableBuffer append(CompositeReadableBuffer buffer); CompositeReadableBuffer append(ReadableBuffer buffer); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString();  }