Package jadex.binary
Class StreamDecodingContext
java.lang.Object
jadex.binary.AbstractDecodingContext
jadex.binary.StreamDecodingContext
- All Implemented Interfaces:
IDecodingContext
,jadex.common.transformation.traverser.IUserContextContainer
- Direct Known Subclasses:
FramingStreamDecodingContext
Context for decoding a binary-encoded object.
-
Nested Class Summary
Nested classes/interfaces inherited from class jadex.binary.AbstractDecodingContext
AbstractDecodingContext.IVersionedHandler, AbstractDecodingContext.VersionedHandler2, AbstractDecodingContext.VersionedHandler3, AbstractDecodingContext.VersionedHandler4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InputStream
The stream being decoded.protected int
Current offset markerFields inherited from class jadex.binary.AbstractDecodingContext
classloader, classnamepool, config, currentclassname, decoderhandlers, errorreporter, knownobjects, lastobject, postprocessors, stringpool, usercontext, versionedhandler
-
Constructor Summary
ConstructorsConstructorDescriptionStreamDecodingContext
(InputStream is, List<IDecoderHandler> decoderhandlers, List<jadex.common.transformation.traverser.ITraverseProcessor> postprocessors, Object usercontext, ClassLoader classloader, jadex.common.transformation.traverser.IErrorReporter errorreporter, SerializationConfig config) Creates a new DecodingContext.StreamDecodingContext
(InputStream is, List<IDecoderHandler> decoderhandlers, List<jadex.common.transformation.traverser.ITraverseProcessor> postprocessors, Object usercontext, ClassLoader classloader, jadex.common.transformation.traverser.IErrorReporter errorreporter, SerializationConfig config, int offset) Creates a new DecodingContext with specific offset. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the current offset of the decoding process for debugging.byte[]
read
(byte[] array) Reads a number of bytes from the buffer and fills the array.byte[]
read
(byte[] array, int woffset, int wlength) Reads a number of bytes from the buffer and fills the array.byte[]
read
(int count) Reads a number of bytes from the buffer.byte
readByte()
Reads a byte from the buffer.Methods inherited from class jadex.binary.AbstractDecodingContext
createObjectId, getClassloader, getCurrentClassName, getDecoderHandlers, getErrorReporter, getLastObject, getObjectForId, getObjectId, getPostProcessors, getUserContext, pooledRead, readBoolean, readClassname, readSignedVarInt, readString, readVarInt, setCurrentClassName, setLastObject, setObjectForId, setVersion, startObjectFrame, startObjectFrame, stopObjectFrame
-
Field Details
-
is
The stream being decoded. -
offset
protected int offsetCurrent offset marker
-
-
Constructor Details
-
StreamDecodingContext
public StreamDecodingContext(InputStream is, List<IDecoderHandler> decoderhandlers, List<jadex.common.transformation.traverser.ITraverseProcessor> postprocessors, Object usercontext, ClassLoader classloader, jadex.common.transformation.traverser.IErrorReporter errorreporter, SerializationConfig config) Creates a new DecodingContext.- Parameters:
classloader
- The classloader.content
- The content being decoded.
-
StreamDecodingContext
public StreamDecodingContext(InputStream is, List<IDecoderHandler> decoderhandlers, List<jadex.common.transformation.traverser.ITraverseProcessor> postprocessors, Object usercontext, ClassLoader classloader, jadex.common.transformation.traverser.IErrorReporter errorreporter, SerializationConfig config, int offset) Creates a new DecodingContext with specific offset.- Parameters:
offset
- The offset.content
- The content being decoded.
-
-
Method Details
-
readByte
public byte readByte()Reads a byte from the buffer.- Returns:
- A byte.
-
read
public byte[] read(int count) Reads a number of bytes from the buffer.- Specified by:
read
in classAbstractDecodingContext
- Parameters:
count
- Number of bytes.- Returns:
- Byte array with the bytes.
-
read
public byte[] read(byte[] array) Reads a number of bytes from the buffer and fills the array.- Specified by:
read
in interfaceIDecodingContext
- Specified by:
read
in classAbstractDecodingContext
- Parameters:
array
- The byte array.- Returns:
- The byte array for convenience.
-
read
public byte[] read(byte[] array, int woffset, int wlength) Reads a number of bytes from the buffer and fills the array.- Specified by:
read
in classAbstractDecodingContext
- Parameters:
array
- The byte array.woffset
- write offset.wlength
- length to read.- Returns:
- The byte array for convenience.
-
getCurrentOffset
public int getCurrentOffset()Returns the current offset of the decoding process for debugging.- Returns:
- Current offset.
-