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
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a new byte[] instance of sizeByteBuffer.getLength()
that contains all the bytes owned by this buffer.static ByteBufferImpl
create
(byte b) static ByteBufferImpl
create
(byte[] array) static ByteBufferImpl
create
(byte[] array, int offset, int length) static ByteBufferImpl
create
(ByteBuffer javaBuffer) boolean
byte[]
getBuf()
Returns the underlying buffer.int
Length bytes, starting from offset, within the underlying byte[] (as returned byByteBuffer.getBuf()
are owned by this buffer instance.int
Returns the offset within the underlying byte[] (as returned byByteBuffer.getBuf()
owned by this buffer instance.int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:ByteBuffer
Returns the underlying buffer.- Specified by:
getBuf
in interfaceByteBuffer
-
getOffset
public int getOffset()Description copied from interface:ByteBuffer
Returns the offset within the underlying byte[] (as returned byByteBuffer.getBuf()
owned by this buffer instance.- Specified by:
getOffset
in interfaceByteBuffer
-
getLength
public int getLength()Description copied from interface:ByteBuffer
Length bytes, starting from offset, within the underlying byte[] (as returned byByteBuffer.getBuf()
are owned by this buffer instance.- Specified by:
getLength
in interfaceByteBuffer
-
copy
Description copied from interface:ByteBuffer
Returns a new byte[] instance of sizeByteBuffer.getLength()
that contains all the bytes owned by this buffer.- Specified by:
copy
in interfaceByteBuffer
-
toString
-
equals
-
hashCode
public int hashCode() -
getStream
- Specified by:
getStream
in interfaceByteBuffer
- Returns:
- an input stream for the bytes in the buffer
-
toJDKByteBuffer
-