Package org.infinispan.commons.io
Class ByteBufferImpl
java.lang.Object
org.infinispan.commons.io.ByteBufferImpl
- All Implemented Interfaces:
ByteBuffer
A byte buffer that exposes the internal byte array with minimal copying
- Since:
- 4.0
- Author:
- (various)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a new byte[] instance of sizeByteBuffer.getLength()that contains all the bytes owned by this buffer.static ByteBufferImplcreate(byte b) static ByteBufferImplcreate(byte[] array) static ByteBufferImplcreate(byte[] array, int offset, int length) static ByteBufferImplcreate(ByteBuffer javaBuffer) booleanbyte[]getBuf()Returns the underlying buffer.intLength bytes, starting from offset, within the underlying byte[] (as returned byByteBuffer.getBuf()are owned by this buffer instance.intReturns the offset within the underlying byte[] (as returned byByteBuffer.getBuf()owned by this buffer instance.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.commons.io.ByteBuffer
trim
-
Field Details
-
EMPTY_INSTANCE
-
-
Method Details
-
create
-
create
-
create
-
create
-
getBuf
public byte[] getBuf()Description copied from interface:ByteBufferReturns the underlying buffer.- Specified by:
getBufin interfaceByteBuffer
-
getOffset
public int getOffset()Description copied from interface:ByteBufferReturns the offset within the underlying byte[] (as returned byByteBuffer.getBuf()owned by this buffer instance.- Specified by:
getOffsetin interfaceByteBuffer
-
getLength
public int getLength()Description copied from interface:ByteBufferLength bytes, starting from offset, within the underlying byte[] (as returned byByteBuffer.getBuf()are owned by this buffer instance.- Specified by:
getLengthin interfaceByteBuffer
-
copy
Description copied from interface:ByteBufferReturns a new byte[] instance of sizeByteBuffer.getLength()that contains all the bytes owned by this buffer.- Specified by:
copyin interfaceByteBuffer
-
toString
-
equals
-
hashCode
public int hashCode() -
getStream
- Specified by:
getStreamin interfaceByteBuffer- Returns:
- an input stream for the bytes in the buffer
-
toJDKByteBuffer
-