@Test public final void testArray() { ReusableBuffer rb = ReusableBuffer.wrap("Yagga Yagga".getBytes()); ReusableBuffer vb = rb.createViewBuffer(); vb.position(0); vb.limit(5); String result = new String(vb.array()); assertEquals("Yagga", result); }
public byte[] array() { assert (!returned) : "Buffer was already freed and cannot be used anymore" + this.freeStack; byte[] array = null; if (this.hasArray() && (this.viewParent == null)) { array = buffer.array(); } else { array = new byte[this.limit()]; final int oldPos = this.position(); this.position(0); this.get(array); this.position(oldPos); } return array; }
ReusableBuffer { public byte[] array() { assert (!returned) : "Buffer was already freed and cannot be used anymore" + this.freeStack; byte[] array = null; if (this.hasArray() && (this.viewParent == null)) { array = buffer.array(); } else { array = new byte[this.limit()]; final int oldPos = this.position(); this.position(0); this.get(array); this.position(oldPos); } return array; } }
ReusableBuffer { public byte[] array() { assert (!returned) : "Buffer was already freed and cannot be used anymore" + this.freeStack; byte[] array = null; if (this.hasArray() && (this.viewParent == null)) { array = buffer.array(); } else { array = new byte[this.limit()]; final int oldPos = this.position(); this.position(0); this.get(array); this.position(oldPos); } return array; } protected  ReusableBuffer(ByteBuffer buffer, int size);  ReusableBuffer(ByteBuffer nonManaged); }
ReusableBuffer { public byte[] array() { assert (!returned) : "Buffer was already freed and cannot be used anymore" + this.freeStack; byte[] array = null; if (this.hasArray() && (this.viewParent == null)) { array = buffer.array(); } else { array = new byte[this.limit()]; final int oldPos = this.position(); this.position(0); this.get(array); this.position(oldPos); } return array; } protected  ReusableBuffer(ByteBuffer buffer, int size);  ReusableBuffer(ByteBuffer nonManaged); static ReusableBuffer wrap(byte[] data); static ReusableBuffer wrap(byte[] data, int offset, int length); ReusableBuffer createViewBuffer(); int capacity(); int capacityUnderlying(); boolean hasArray(); byte[] array(); void flip(); void compact(); void limit(int l); int limit(); void position(int p); int position(); boolean hasRemaining(); ByteBuffer getBuffer(); boolean isReusable(); byte get(); byte get(int index); ReusableBuffer get(byte[] dst); ReusableBuffer get(byte[] dst, int offset, int length); ReusableBuffer put(byte b); ReusableBuffer put(byte[] src); ReusableBuffer put(byte[] src, int offset, int len); ReusableBuffer put(ByteBuffer src); ReusableBuffer put(ReusableBuffer src); int getInt(); ReusableBuffer putInt(int i); long getLong(); ReusableBuffer putLong(long l); double getDouble(); ReusableBuffer putDouble(double d); String getString(); ReusableBuffer putString(String str); ReusableBuffer putShortString(String str); ASCIIString getBufferBackedASCIIString(); ReusableBuffer putBufferBackedASCIIString(ASCIIString str); ReusableBuffer putShort(short s); short getShort(); boolean isDirect(); int remaining(); void clear(); byte[] getData(); void shrink(int newSize); boolean enlarge(int newSize); void range(int offset, int length); ReusableBuffer putBoolean(boolean bool); boolean getBoolean(); int getRefCount(); @Override String toString(); }
ReusableBuffer { public byte[] array() { assert (!returned) : "Buffer was already freed and cannot be used anymore" + this.freeStack; byte[] array = null; if (this.hasArray() && (this.viewParent == null)) { array = buffer.array(); } else { array = new byte[this.limit()]; final int oldPos = this.position(); this.position(0); this.get(array); this.position(oldPos); } return array; } protected  ReusableBuffer(ByteBuffer buffer, int size);  ReusableBuffer(ByteBuffer nonManaged); static ReusableBuffer wrap(byte[] data); static ReusableBuffer wrap(byte[] data, int offset, int length); ReusableBuffer createViewBuffer(); int capacity(); int capacityUnderlying(); boolean hasArray(); byte[] array(); void flip(); void compact(); void limit(int l); int limit(); void position(int p); int position(); boolean hasRemaining(); ByteBuffer getBuffer(); boolean isReusable(); byte get(); byte get(int index); ReusableBuffer get(byte[] dst); ReusableBuffer get(byte[] dst, int offset, int length); ReusableBuffer put(byte b); ReusableBuffer put(byte[] src); ReusableBuffer put(byte[] src, int offset, int len); ReusableBuffer put(ByteBuffer src); ReusableBuffer put(ReusableBuffer src); int getInt(); ReusableBuffer putInt(int i); long getLong(); ReusableBuffer putLong(long l); double getDouble(); ReusableBuffer putDouble(double d); String getString(); ReusableBuffer putString(String str); ReusableBuffer putShortString(String str); ASCIIString getBufferBackedASCIIString(); ReusableBuffer putBufferBackedASCIIString(ASCIIString str); ReusableBuffer putShort(short s); short getShort(); boolean isDirect(); int remaining(); void clear(); byte[] getData(); void shrink(int newSize); boolean enlarge(int newSize); void range(int offset, int length); ReusableBuffer putBoolean(boolean bool); boolean getBoolean(); int getRefCount(); @Override String toString();  }