Package jadex.binary
Class FramingEncodingContext
java.lang.Object
jadex.binary.AbstractEncodingContext
jadex.binary.FramingEncodingContext
- All Implemented Interfaces:
IEncodingContext,jadex.common.transformation.traverser.IRootObjectContext,jadex.common.transformation.traverser.IUserContextContainer
Encoding context with framing output.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]The buffer.The frame stack, buffer position and fixed size marker.Fields inherited from class jadex.binary.AbstractEncodingContext
classidcache, classloader, classnamepool, ignorewriteclass, knownobjects, lastinputobject, nonanonclasscache, preprocessors, rootobject, stringpool, usercontext, writtenbytes -
Constructor Summary
ConstructorsConstructorDescriptionFramingEncodingContext(Object rootobject, Object usercontext, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, ClassLoader classloader, SerializationConfig config) Creates an encoding context. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidensureSpace(int requiredsize) Ensures sufficient space in buffer.voidstartObjectFrame(boolean fixedsize) Starts an object frame when using a context with framing support.voidStops an object frame when using a context with framing support.byte[]Returns the current data buffer, trimmed to size.voidwrite(byte[] b) Writes a byte array.voidwriteByte(byte b) Writes a byte.Methods inherited from class jadex.binary.AbstractEncodingContext
createObjectId, getClassLoader, getNonInnerClassCache, getObjectId, getPreprocessors, getRootObject, getUserContext, getWrittenBytes, isIgnoreNextClassWrite, pooledWrite, setIgnoreNextClassWrite, setInputObject, startObjectFrame, writeBoolean, writeClass, writeClassname, writeSignedVarInt, writeString, writeVarInt
-
Field Details
-
buffer
protected byte[] bufferThe buffer. -
framestack
The frame stack, buffer position and fixed size marker.
-
-
Constructor Details
-
FramingEncodingContext
public FramingEncodingContext(Object rootobject, Object usercontext, List<jadex.common.transformation.traverser.ITraverseProcessor> preprocessors, ClassLoader classloader, SerializationConfig config) Creates an encoding context.- Parameters:
usercontext- A user context.preprocessors- The preprocessors.classloader- The classloader.
-
-
Method Details
-
startObjectFrame
public void startObjectFrame(boolean fixedsize) Starts an object frame when using a context with framing support.- Specified by:
startObjectFramein interfaceIEncodingContext- Overrides:
startObjectFramein classAbstractEncodingContext- Parameters:
fixedsize- If true, use fixed-size (integer) framing. Set true if the object being framed is expected to be larger than 127 bytes (same type of object MUST use either fixed OR variable framing).
-
stopObjectFrame
public void stopObjectFrame()Stops an object frame when using a context with framing support.- Specified by:
stopObjectFramein interfaceIEncodingContext- Overrides:
stopObjectFramein classAbstractEncodingContext
-
writeByte
public void writeByte(byte b) Description copied from interface:IEncodingContextWrites a byte.- Parameters:
b- The byte.
-
write
public void write(byte[] b) Description copied from interface:IEncodingContextWrites a byte array.- Parameters:
b- The byte array.
-
toByteArray
public byte[] toByteArray()Returns the current data buffer, trimmed to size.- Returns:
- The buffer.
-
ensureSpace
protected void ensureSpace(int requiredsize) Ensures sufficient space in buffer.- Parameters:
requiredsize- Required space in buffer.
-