Package org.infinispan.commons.io
Class ByteBufferImpl
- java.lang.Object
-
- org.infinispan.commons.io.ByteBufferImpl
-
- All Implemented Interfaces:
ByteBuffer
public class ByteBufferImpl extends java.lang.Object implements ByteBuffer
A byte buffer that exposes the internal byte array with minimal copying- Since:
- 4.0
- Author:
- (various)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classByteBufferImpl.Externalizer
-
Constructor Summary
Constructors Constructor Description ByteBufferImpl(byte[] buf)ByteBufferImpl(byte[] buf, int offset, int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferImplcopy()Returns a new byte[] instance of sizeByteBuffer.getLength()that contains all the bytes owned by this buffer.booleanequals(java.lang.Object o)byte[]getBuf()Returns the underlying buffer.intgetLength()Length bytes, starting from offset, within the underlying byte[] (as returned byByteBuffer.getBuf()are owned by this buffer instance.intgetOffset()Returns the offset within the underlying byte[] (as returned byByteBuffer.getBuf()owned by this buffer instance.java.io.InputStreamgetStream()inthashCode()java.nio.ByteBuffertoJDKByteBuffer()java.lang.StringtoString()
-
-
-
Method Detail
-
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
public ByteBufferImpl 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getStream
public java.io.InputStream getStream()
- Returns:
- an input stream for the bytes in the buffer
-
toJDKByteBuffer
public java.nio.ByteBuffer toJDKByteBuffer()
-
-