Package jadex.binary
Class FramingEncodingContext
- java.lang.Object
-
- jadex.binary.AbstractEncodingContext
-
- jadex.binary.FramingEncodingContext
-
- All Implemented Interfaces:
IEncodingContext,IRootObjectContext,IUserContextContainer
public class FramingEncodingContext extends AbstractEncodingContext
Encoding context with framing output.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufferThe buffer.protected java.util.Deque<Tuple2<java.lang.Integer,java.lang.Boolean>>framestackThe 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
Constructors Constructor Description FramingEncodingContext(java.lang.Object rootobject, java.lang.Object usercontext, java.util.List<ITraverseProcessor> preprocessors, java.lang.ClassLoader classloader, SerializationConfig config)Creates an encoding context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidensureSpace(int requiredsize)Ensures sufficient space in buffer.voidstartObjectFrame(boolean fixedsize)Starts an object frame when using a context with framing support.voidstopObjectFrame()Stops an object frame when using a context with framing support.byte[]toByteArray()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 Detail
-
buffer
protected byte[] buffer
The buffer.
-
framestack
protected java.util.Deque<Tuple2<java.lang.Integer,java.lang.Boolean>> framestack
The frame stack, buffer position and fixed size marker.
-
-
Constructor Detail
-
FramingEncodingContext
public FramingEncodingContext(java.lang.Object rootobject, java.lang.Object usercontext, java.util.List<ITraverseProcessor> preprocessors, java.lang.ClassLoader classloader, SerializationConfig config)Creates an encoding context.- Parameters:
usercontext- A user context.preprocessors- The preprocessors.classloader- The classloader.
-
-
Method Detail
-
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.
-
-