|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-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.AbstractByteArrayReadBuffer
public abstract class AbstractByteArrayReadBuffer
The AbstractByteArrayReadBuffer abstract class is intended to serve as a base class for the following:
This implementation is not intended to be thread safe.
| Nested Class Summary | |
|---|---|
class |
AbstractByteArrayReadBuffer.ByteArrayBufferInputThis is a simple implementation of the BufferInput interface on top of a byte array. |
| 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 | |
|---|---|
protected byte[] |
m_abThe byte array that holds the binary data. |
protected int |
m_cbNumber of bytes in the byte array that belong to this ReadBuffer object. |
protected int |
m_ofOffset into the byte array at which the binary data is located. |
| Fields inherited from class com.tangosol.io.AbstractReadBuffer |
|---|
NO_BINARY, NO_BYTES |
| Constructor Summary | |
|---|---|
protected |
AbstractByteArrayReadBuffer()Default constructor; intended for deserialization use by subclasses. |
protected |
AbstractByteArrayReadBuffer(byte[] ab, int of, int cb)Construct an AbstractByteArrayReadBuffer on a portion of a byte array. |
| Method Summary | |
|---|---|
byte |
byteAt(int of)Returns the byte at the specified offset. |
void |
copyBytes(int ofBegin, int ofEnd, byte[] abDest, int ofDest)Copies bytes from this ReadBuffer into the destination byte array. |
boolean |
equals(java.lang.Object o)Compare two ReadBuffer objects for equality. |
protected ReadBuffer.BufferInput |
instantiateBufferInput()Factory method: Instantiate a BufferInput object to read data from the ReadBuffer. |
protected abstract boolean |
isByteArrayPrivate()Determine if the underlying byte[] should be treated as private data. |
int |
length()Determine the length of the buffer. |
protected void |
resetRange(int of, int cb)Reset the portion of the byte array the ReadBuffer operates upon. |
Binary |
toBinary()Return a new Binary object that holds the complete contents of this ReadBuffer. |
Binary |
toBinary(int of, int cb)Return 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. |
java.nio.ByteBuffer |
toByteBuffer()Return a read-only ByteBuffer view of this ReadBuffer. |
java.nio.ByteBuffer |
toByteBuffer(int of, int cb)Return a read-only ByteBuffer view of the specified portion of this ReadBuffer. |
void |
writeTo(java.nio.ByteBuffer buf)Write the contents of the Binary object to a ByteBuffer. |
void |
writeTo(java.nio.ByteBuffer buf, int of, int cb)Write the contents of the Binary object to a ByteBuffer. |
void |
writeTo(java.io.DataOutput out)Write the contents of this ReadBuffer to a DataOutput. |
void |
writeTo(java.io.DataOutput out, int of, int cb)Write the contents of this ReadBuffer to a DataOutput. |
void |
writeTo(java.io.OutputStream out)Write the contents of this ReadBuffer to an OutputStream. |
void |
writeTo(java.io.OutputStream out, int of, int cb)Write the contents of the ReadBuffer to an OutputStream. |
| Methods inherited from class com.tangosol.io.AbstractReadBuffer |
|---|
checkBounds, clone, getBufferInput, getReadBuffer, instantiateReadBuffer, readPackedInt, readUnsignedByte, sizeofPackedInt, subSequence, toByteArray |
| Field Detail |
|---|
protected byte[] m_ab
protected int m_of
protected int m_cb
| Constructor Detail |
|---|
protected AbstractByteArrayReadBuffer()
Note that this default constructor leaves the buffer in an invalid state.
protected AbstractByteArrayReadBuffer(byte[] ab,
int of,
int cb)
ab - a byte arrayof - an offset into the byte arraycb - the number of bytes to utilizejava.lang.IndexOutOfBoundsException - if of or cb is negative, or of + cb is larger than ab.lengthjava.lang.NullPointerException - if ab is null| Method Detail |
|---|
public int length()
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.of - the offset (index) of the byte
public 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 sub-array 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.
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 to
public void writeTo(java.io.OutputStream out)
throws java.io.IOException
out - an OutputStream to write tojava.io.IOException - if an I/O exception occurs
public void writeTo(java.io.OutputStream out,
int of,
int cb)
throws java.io.IOException
out - an OutputStream to write toof - the beginning index, inclusivecb - the number of bytes to write to an OutputStreamjava.io.IOException - if an I/O exception occurs
public void writeTo(java.io.DataOutput out)
throws java.io.IOException
out - a DataOutput to write tojava.io.IOException - if an I/O exception occurs
public void writeTo(java.io.DataOutput out,
int of,
int cb)
throws java.io.IOException
out - a DataOutput to write toof - the beginning index, inclusivecb - the number of bytes to write to a DataOutputjava.io.IOException - if an I/O exception occurspublic void writeTo(java.nio.ByteBuffer buf)
buf - a ByteBuffer to write to
public void writeTo(java.nio.ByteBuffer buf,
int of,
int cb)
throws java.io.IOException
buf - an ByteBuffer to write toof - the beginning index, inclusivecb - the number of bytes to write to a ByteBufferjava.io.IOException - if an I/O exception occurs
public byte[] toByteArray(int of,
int cb)
This method is an equivalent of getReadBuffer(of, cb).toByteArray().
toByteArray in interface ReadBuffertoByteArray in class AbstractReadBufferof - the beginning index, inclusivecb - the number of bytes to include in the resulting byte[]public Binary toBinary()
This is the equivalent of toBinary(0, length()).
toBinary in interface ReadBuffertoBinary in interface ByteSequencetoBinary in class AbstractReadBuffer
public Binary toBinary(int of,
int cb)
This method is an equivalent of getReadBuffer(of, cb).toBinary().
toBinary in interface ReadBuffertoBinary in class AbstractReadBufferof - the beginning index, inclusivecb - the number of bytes to include in the Binary objectpublic java.nio.ByteBuffer toByteBuffer()
public java.nio.ByteBuffer toByteBuffer(int of,
int cb)
This method is an equivalent of getReadBuffer(of, cb).toByteBuffer().
of - the beginning index, inclusivecb - the number of bytes to include in the ByteBuffer objectpublic boolean equals(java.lang.Object o)
equals in interface ReadBufferequals in class AbstractReadBuffero - a ReadBuffer objectprotected ReadBuffer.BufferInput instantiateBufferInput()
instantiateBufferInput in class AbstractReadBuffer
protected void resetRange(int of,
int cb)
of - an offset into the byte arraycb - the number of bytes to utilizejava.lang.IndexOutOfBoundsException - if of or cb are negative, or of + cb is larger than the buffer's lengthprotected abstract boolean isByteArrayPrivate()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||