Package com.tangosol.io
Class WrapperBufferInput
java.lang.Object
java.io.InputStream
com.tangosol.io.WrapperDataInputStream
com.tangosol.io.WrapperBufferInput
- All Implemented Interfaces:
com.oracle.coherence.common.io.InputStreaming
,InputStreaming
,ReadBuffer.BufferInput
,Closeable
,DataInput
,AutoCloseable
- Direct Known Subclasses:
WrapperBufferInput.VersionAwareBufferInput
This is an imitation BufferInput implementation that provides the
BufferInput interface by delegating to an object that implements the
DataInput interface. Primarily, this is intended as a base class for
building specific-purpose DataInput wrappers.
- Author:
- jh 2007.11.17
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A BufferInput implementation that in addition to delegating to the given DataInput provides an API to check whether the sender of the content of this BufferInput runs a version that supersedes (greater or equal to) the specified version. -
Field Summary
Fields inherited from class com.tangosol.io.WrapperDataInputStream
m_in, m_loader
-
Constructor Summary
ConstructorDescriptionConstruct a WrapperBufferInput that will read from the specified object implementing the DataInput interface.WrapperBufferInput
(DataInput in, ClassLoader loader) Construct a WrapperBufferInput that will read from the specified object implementing the DataInput interface. -
Method Summary
Modifier and TypeMethodDescriptionGet the ReadBuffer object that this BufferInput is reading from.Obtain the underlying object providing the DataInput interface that this object is delegating to.Returns an ObjectInputFilter (or null) that should be used by the caller to confirm / deny deserialization of a class encoded in this input stream.int
Determine the current offset of this BufferInput within the underlying ReadBuffer.readBuffer
(int cb) Readcb
bytes and return them as a ReadBuffer object.int
Read an int value using a variable-length storage format as described byWriteBuffer.BufferOutput.writePackedInt(int)
.long
Read a long value using a variable-length storage format as described byWriteBuffer.BufferOutput.writePackedLong(long)
.Read a variable-length encoded UTF packed String.void
setObjectInputFilter
(Object filter) Set theObjectInputFilter
for this stream.void
setOffset
(int of) Specify the offset of the next byte to read from the underlying ReadBuffer.Methods inherited from class com.tangosol.io.WrapperDataInputStream
available, close, getClassLoader, mark, markSupported, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, reset, setClassLoader, skip, skipBytes
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.oracle.coherence.common.io.InputStreaming
read, read, read, reset, skip
Methods inherited from interface com.tangosol.io.ReadBuffer.BufferInput
available, close, mark, markSupported, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
Constructor Details
-
WrapperBufferInput
Construct a WrapperBufferInput that will read from the specified object implementing the DataInput interface.- Parameters:
in
- an object implementing DataInput to read from
-
WrapperBufferInput
Construct a WrapperBufferInput that will read from the specified object implementing the DataInput interface.- Parameters:
in
- an object implementing DataInput to read fromloader
- the ClassLoader to use
-
-
Method Details
-
getBuffer
Get the ReadBuffer object that this BufferInput is reading from.- Specified by:
getBuffer
in interfaceReadBuffer.BufferInput
- Returns:
- the underlying ReadBuffer object
-
readSafeUTF
Read a variable-length encoded UTF packed String. The major differences between this implementation and DataInput is that this supports null String values and is not limited to 64KB UTF-encoded values.- Specified by:
readSafeUTF
in interfaceReadBuffer.BufferInput
- Returns:
- a String value; may be null
- Throws:
IOException
- if an I/O error occurs
-
readPackedInt
Read an int value using a variable-length storage format as described byWriteBuffer.BufferOutput.writePackedInt(int)
.- Specified by:
readPackedInt
in interfaceReadBuffer.BufferInput
- Returns:
- an int value
- Throws:
IOException
- if an I/O error occurs
-
readPackedLong
Read a long value using a variable-length storage format as described byWriteBuffer.BufferOutput.writePackedLong(long)
.- Specified by:
readPackedLong
in interfaceReadBuffer.BufferInput
- Returns:
- a long value
- Throws:
IOException
- if an I/O error occurs
-
readBuffer
Readcb
bytes and return them as a ReadBuffer object.- Specified by:
readBuffer
in interfaceReadBuffer.BufferInput
- Parameters:
cb
- the number of bytes to read- Returns:
- a ReadBuffer object composed of
cb
bytes read from the BufferInput - Throws:
IOException
- if an I/O error occurs
-
getOffset
public int getOffset()Determine the current offset of this BufferInput within the underlying ReadBuffer.- Specified by:
getOffset
in interfaceReadBuffer.BufferInput
- Returns:
- the offset of the next byte to read from the ReadBuffer
-
setOffset
public void setOffset(int of) Specify the offset of the next byte to read from the underlying ReadBuffer.- Specified by:
setOffset
in interfaceReadBuffer.BufferInput
- Parameters:
of
- the offset of the next byte to read from the ReadBuffer
-
getObjectInputFilter
Description copied from interface:ReadBuffer.BufferInput
Returns an ObjectInputFilter (or null) that should be used by the caller to confirm / deny deserialization of a class encoded in this input stream.Note: the return type is agnostic of the ObjectInputFilter to support various JDK versions.
- Specified by:
getObjectInputFilter
in interfaceReadBuffer.BufferInput
- Returns:
- null or an ObjectInputFilter that will permit (or not) the constructor of a class encoded in this stream.
- See Also:
-
setObjectInputFilter
Description copied from interface:ReadBuffer.BufferInput
Set theObjectInputFilter
for this stream.The filter's checkInput method is expected to be called for each class and reference deserialized in the stream.
- Specified by:
setObjectInputFilter
in interfaceReadBuffer.BufferInput
- Parameters:
filter
- an ObjectInputFilter instance as an Object to enable running with Java version 8 or higher, may be null
-
getDataInput
Obtain the underlying object providing the DataInput interface that this object is delegating to.- Overrides:
getDataInput
in classWrapperDataInputStream
- Returns:
- the underlying DataInput
-