Package com.tangosol.io
Class ByteArrayReadBuffer
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.AbstractReadBuffer
com.tangosol.io.AbstractByteArrayReadBuffer
com.tangosol.io.ByteArrayReadBuffer
- All Implemented Interfaces:
ReadBuffer
,ByteSequence
,HashEncoded
,Cloneable
A ReadBuffer on top of a byte array.
- Author:
- cp 2005.01.20
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
AbstractByteArrayReadBuffer.ByteArrayBufferInput
Nested classes/interfaces inherited from class com.tangosol.io.AbstractReadBuffer
AbstractReadBuffer.AbstractBufferInput
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
Nested classes/interfaces inherited from interface com.tangosol.io.ReadBuffer
ReadBuffer.BufferInput
-
Field Summary
Fields inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
m_ab, m_cb, m_of
Fields inherited from class com.tangosol.io.AbstractReadBuffer
NO_BINARY, NO_BYTES
Fields inherited from class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
Fields inherited from interface com.tangosol.util.HashEncoded
UNENCODED
-
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor provided for subclasses.ByteArrayReadBuffer
(byte[] ab) Construct a ByteArrayReadBuffer object from a byte array.ByteArrayReadBuffer
(byte[] ab, int of, int cb) Construct a ByteArrayReadBuffer object from a portion of a byte array.ByteArrayReadBuffer
(byte[] ab, int of, int cb, boolean fCopy, boolean fPrivate, boolean fShallowClone) Construct a ByteArrayReadBuffer object from a portion of a byte array. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Create a clone of this ReadBuffer object.final byte[]
Obtain the byte array that this ReadBuffer uses.final int
Determine the offset into the byte array returned fromgetRawByteArray()
that this ReadBuffer uses.protected final ReadBuffer
instantiateReadBuffer
(int of, int cb) Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer.protected final boolean
Determine if the underlying byte[] should be treated as private data.protected final boolean
Determine whether a clone can be made without cloning the byte array.final void
resetRange
(int of, int cb) Reset the portion of the byte array the ReadBuffer operates upon.toString()
Provide a human-readable representation of the Binary object.Methods inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
byteAt, copyBytes, equals, instantiateBufferInput, length, toBinary, toBinary, toByteArray, toByteBuffer, toByteBuffer, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo
Methods inherited from class com.tangosol.io.AbstractReadBuffer
checkBounds, getBufferInput, getEncodedHash, getReadBuffer, readPackedInt, readUnsignedByte, sizeofPackedInt, subSequence, toByteArray
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Constructor Details
-
ByteArrayReadBuffer
protected ByteArrayReadBuffer()Default constructor provided for subclasses. -
ByteArrayReadBuffer
public ByteArrayReadBuffer(byte[] ab) Construct a ByteArrayReadBuffer object from a byte array. This constructor does not copy the byte array or make it private.- Parameters:
ab
- an array of bytes
-
ByteArrayReadBuffer
public ByteArrayReadBuffer(byte[] ab, int of, int cb) Construct a ByteArrayReadBuffer object from a portion of a byte array. This constructor does not copy the byte array or make it private.- Parameters:
ab
- an array of bytesof
- the offset into the byte arraycb
- the number of bytes to extract
-
ByteArrayReadBuffer
public ByteArrayReadBuffer(byte[] ab, int of, int cb, boolean fCopy, boolean fPrivate, boolean fShallowClone) Construct a ByteArrayReadBuffer object from a portion of a byte array.- Parameters:
ab
- an array of bytesof
- the offset into the byte arraycb
- the number of bytes to extractfCopy
- true to make a copy of the passed arrayfPrivate
- true to treat the passed array as private datafShallowClone
- true to allow cloning without copying the underlying byte[]
-
-
Method Details
-
resetRange
public final void resetRange(int of, int cb) Reset the portion of the byte array the ReadBuffer operates upon.- Overrides:
resetRange
in classAbstractByteArrayReadBuffer
- Parameters:
of
- an offset into the byte arraycb
- the number of bytes to utilize
-
getRawByteArray
public final byte[] getRawByteArray()Obtain the byte array that this ReadBuffer uses. If the underlying byte array is private, then this method will always return a copy of the portion of the byte array that this ReadBuffer represents as if the called had calledAbstractReadBuffer.toByteArray()
.- Returns:
- the byte array that this ReadBuffer uses
-
getRawOffset
public final int getRawOffset()Determine the offset into the byte array returned fromgetRawByteArray()
that this ReadBuffer uses. If the underlying byte array is private, then this method will always return zero becausegetRawByteArray()
will always return a copy of the portion of the byte array that this ReadBuffer represents.- Returns:
- the offset into the raw byte array that this ReadBuffer uses
-
instantiateReadBuffer
Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer.- Specified by:
instantiateReadBuffer
in classAbstractReadBuffer
- Parameters:
of
- the beginning index, inclusivecb
- the number of bytes to include in the resulting ReadBuffer- Returns:
- a ReadBuffer that represents a portion of this ReadBuffer
-
clone
Create a clone of this ReadBuffer object.- Specified by:
clone
in interfaceReadBuffer
- Overrides:
clone
in classAbstractReadBuffer
- Returns:
- a ReadBuffer object with the same contents as this ReadBuffer object
-
toString
Provide a human-readable representation of the Binary object. -
isByteArrayPrivate
protected final boolean isByteArrayPrivate()Determine if the underlying byte[] should be treated as private data.- Specified by:
isByteArrayPrivate
in classAbstractByteArrayReadBuffer
- Returns:
- true iff the underlying data should not ever be exposed by this object
-
isShallowCloneable
protected final boolean isShallowCloneable()Determine whether a clone can be made without cloning the byte array.- Returns:
- true iff the underlying data can be shared by multiple instances of the ByteArrayReadBuffer class
-