|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.AbstractReadBuffer
com.tangosol.io.nio.ByteBufferReadBuffer
public class ByteBufferReadBuffer
A ReadBuffer implementation on top of a Java NIO ByteBuffer.
Nested Class Summary | |
---|---|
class |
ByteBufferReadBuffer.ByteBufferInput This is a simple implementation of the BufferInput interface on top of a ByteBuffer. |
Nested classes/interfaces inherited from class com.tangosol.io.AbstractReadBuffer |
---|
AbstractReadBuffer.AbstractBufferInput |
Nested classes/interfaces inherited from interface com.tangosol.io.ReadBuffer |
---|
ReadBuffer.BufferInput |
Field Summary |
---|
Fields inherited from class com.tangosol.io.AbstractReadBuffer |
---|
NO_BINARY, NO_BYTES |
Constructor Summary | |
---|---|
ByteBufferReadBuffer(java.nio.ByteBuffer buf) Construct a ByteBufferReadBuffer on an NIO ByteBuffer. |
Method Summary | |
---|---|
byte |
byteAt(int of) Returns the byte at the specified offset. |
java.lang.Object |
clone() Create a clone of this ReadBuffer object. |
void |
copyBytes(int ofBegin, int ofEnd, byte[] abDest, int ofDest) Copies bytes from this ReadBuffer into the destination byte array. |
java.nio.ByteBuffer |
getByteBuffer() Obtain the ByteBuffer that this ReadBuffer is based on. |
protected ReadBuffer.BufferInput |
instantiateBufferInput() Factory method: Instantiate a BufferInput object to read data from the ReadBuffer. |
protected ReadBuffer |
instantiateReadBuffer(int of, int cb) Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer. |
int |
length() Determine the length of the buffer. |
Binary |
toBinary(int of, int cb) Returns a Binary object that holds the specified portion of this ReadBuffer. |
byte[] |
toByteArray(int of, int cb) Get a portion of the contents of the ReadBuffer as a byte array. |
Methods inherited from class com.tangosol.io.AbstractReadBuffer |
---|
checkBounds, equals, getBufferInput, getReadBuffer, subSequence, toBinary, toByteArray |
Methods inherited from interface com.tangosol.io.ReadBuffer |
---|
equals, getBufferInput, getReadBuffer, subSequence, toBinary, toByteArray |
Constructor Detail |
---|
public ByteBufferReadBuffer(java.nio.ByteBuffer buf)
buf
- the underlying NIO ByteBufferMethod Detail |
---|
public java.nio.ByteBuffer getByteBuffer()
public int length()
length
in interface ReadBuffer
length
in interface ByteSequence
public byte byteAt(int of)
0
to length() - 1
. The first byte of the sequence is at offset 0
, the next at offset 1
, and so on, as for array indexing.byteAt
in interface ReadBuffer
byteAt
in interface ByteSequence
of
- the offset (index) of the bytepublic void copyBytes(int ofBegin, int ofEnd, byte[] abDest, int ofDest)
The first byte to be copied is at offset ofBegin
; the last byte to be copied is at offset ofEnd-1
(thus the total number of bytes to be copied is ofEnd - ofBegin
). The bytes are copied into the subarray of abDest
starting at offset ofDest
and ending at index:
ofDest + (ofEnd - ofBegin) - 1
This method is the ReadBuffer equivalent of String.getChars(int, int, char[], int)
. It allows the caller to extract a chunk of bytes into the caller's own array.
copyBytes
in interface ReadBuffer
ofBegin
- offset of the first byte in the ReadBuffer to copyofEnd
- offset after the last byte in the ReadBuffer to copyabDest
- the destination byte arrayofDest
- the offset in the destination byte array to copy the first byte topublic byte[] toByteArray(int of, int cb)
This is the equivalent of getReadBuffer(of, cb).toByteArray()
.
toByteArray
in interface ReadBuffer
toByteArray
in class AbstractReadBuffer
of
- the beginning index, inclusivecb
- the number of bytes to include in the resulting byte[]public Binary toBinary(int of, int cb)
This is the equivalent of getReadBuffer(of, cb).toBinary()
.
toBinary
in interface ReadBuffer
toBinary
in class AbstractReadBuffer
of
- the beginning index, inclusivecb
- the number of bytes to include in the Binary objectpublic java.lang.Object clone()
clone
in interface ReadBuffer
clone
in class AbstractReadBuffer
protected ReadBuffer instantiateReadBuffer(int of, int cb)
instantiateReadBuffer
in class AbstractReadBuffer
of
- the beginning index, inclusivecb
- the number of bytes to include in the resulting ReadBufferprotected ReadBuffer.BufferInput instantiateBufferInput()
instantiateBufferInput
in class AbstractReadBuffer
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |