Package jadex.binary
Class AbstractDecodingContext
- java.lang.Object
- 
- jadex.binary.AbstractDecodingContext
 
- 
- All Implemented Interfaces:
- IDecodingContext,- IUserContextContainer
 - Direct Known Subclasses:
- DataInputDecodingContext,- StreamDecodingContext
 
 public abstract class AbstractDecodingContext extends java.lang.Object implements IDecodingContext Abstract base class for decoding context.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static interfaceAbstractDecodingContext.IVersionedHandlerInterface for versioned operations.protected classAbstractDecodingContext.VersionedHandler2Operations for format version 2.protected classAbstractDecodingContext.VersionedHandler3Operations for format version 3.protected classAbstractDecodingContext.VersionedHandler4Operations for format version 4.
 - 
Field SummaryFields Modifier and Type Field Description protected java.lang.ClassLoaderclassloaderThe classloaderprotected java.util.List<java.lang.String>classnamepoolThe class name pool.protected SerializationConfigconfigThe serialization config.protected java.lang.StringcurrentclassnameThe current class name.protected java.util.List<IDecoderHandler>decoderhandlersThe decoder handlers.protected IErrorReportererrorreporterError Reporterprotected BiHashMap<java.lang.Long,java.lang.Object>knownobjectsprotected java.lang.ObjectlastobjectThe last decoded objectprotected java.util.List<ITraverseProcessor>postprocessorsThe postprocessors.protected java.util.List<java.lang.String>stringpoolThe String pool.protected java.lang.ObjectusercontextA user context.protected AbstractDecodingContext.IVersionedHandlerversionedhandlerHandler for versioned operations.
 - 
Constructor SummaryConstructors Constructor Description AbstractDecodingContext(java.util.List<IDecoderHandler> decoderhandlers, java.util.List<ITraverseProcessor> postprocessors, java.lang.Object usercontext, java.lang.ClassLoader classloader, IErrorReporter errorreporter, SerializationConfig config)Initializes the context.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longcreateObjectId(java.lang.Object object)Creates ID for an object.java.lang.ClassLoadergetClassloader()Gets the classloader.java.lang.StringgetCurrentClassName()Gets the current class name.java.util.List<IDecoderHandler>getDecoderHandlers()Returns the handlers used to decode objects.IErrorReportergetErrorReporter()Gets the error reporter.java.lang.ObjectgetLastObject()Returns the last object decoded.java.lang.ObjectgetObjectForId(long id)Gets a known object by ID.java.lang.LonggetObjectId(java.lang.Object object)Gets the ID of a known object.java.util.List<ITraverseProcessor>getPostProcessors()Returns the handlers used for post-processing.java.lang.ObjectgetUserContext()Returns the user context.java.lang.StringpooledRead(java.util.List<java.lang.String> pool)Readsa a string using a pool.abstract byte[]read(byte[] array)Reads a number of bytes from the buffer and fills the array.abstract byte[]read(byte[] array, int woffset, int wlength)Reads a number of bytes from the buffer and fills the array.abstract byte[]read(int count)Reads a number of bytes from the buffer.booleanreadBoolean()Reads a boolean value from the buffer.java.lang.StringreadClassname()Helper method for decoding a class name.longreadSignedVarInt()Helper method for decoding a signed variable-sized integer (VarInt).java.lang.StringreadString()Helper method for decoding a string.longreadVarInt()Helper method for decoding a variable-sized integer (VarInt).protected voidsetCurrentClassName(java.lang.String currentclassname)Sets the current class name.voidsetLastObject(java.lang.Object lastobject)Sets the last object decoded.voidsetObjectForId(long id, java.lang.Object object)Sets a known object by ID.voidsetVersion(int version)Sets the format version.voidstartObjectFrame()Starts an object frame when using a context with framing support.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.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface jadex.binary.IDecodingContextgetCurrentOffset, readByte
 
- 
 
- 
- 
- 
Field Detail- 
classloaderprotected java.lang.ClassLoader classloader The classloader
 - 
decoderhandlersprotected java.util.List<IDecoderHandler> decoderhandlers The decoder handlers.
 - 
versionedhandlerprotected AbstractDecodingContext.IVersionedHandler versionedhandler Handler for versioned operations.
 - 
stringpoolprotected java.util.List<java.lang.String> stringpool The String pool.
 - 
classnamepoolprotected java.util.List<java.lang.String> classnamepool The class name pool.
 - 
usercontextprotected java.lang.Object usercontext A user context.
 - 
postprocessorsprotected java.util.List<ITraverseProcessor> postprocessors The postprocessors.
 - 
lastobjectprotected java.lang.Object lastobject The last decoded object
 - 
currentclassnameprotected java.lang.String currentclassname The current class name.
 - 
errorreporterprotected IErrorReporter errorreporter Error Reporter
 - 
knownobjectsprotected BiHashMap<java.lang.Long,java.lang.Object> knownobjects 
 - 
configprotected SerializationConfig config The serialization config.
 
- 
 - 
Constructor Detail- 
AbstractDecodingContextpublic AbstractDecodingContext(java.util.List<IDecoderHandler> decoderhandlers, java.util.List<ITraverseProcessor> postprocessors, java.lang.Object usercontext, java.lang.ClassLoader classloader, IErrorReporter errorreporter, SerializationConfig config) Initializes the context.
 
- 
 - 
Method Detail- 
getClassloaderpublic java.lang.ClassLoader getClassloader() Gets the classloader.- Specified by:
- getClassloaderin interface- IDecodingContext
- Returns:
- The classloader.
 
 - 
getDecoderHandlerspublic java.util.List<IDecoderHandler> getDecoderHandlers() Returns the handlers used to decode objects.- Specified by:
- getDecoderHandlersin interface- IDecodingContext
- Returns:
- The handlers.
 
 - 
getPostProcessorspublic java.util.List<ITraverseProcessor> getPostProcessors() Returns the handlers used for post-processing.- Specified by:
- getPostProcessorsin interface- IDecodingContext
- Returns:
- Post-processing handlers.
 
 - 
createObjectIdpublic long createObjectId(java.lang.Object object) Creates ID for an object.- Specified by:
- createObjectIdin interface- IDecodingContext
- Parameters:
- object- The object
- Returns:
- The ID.
 
 - 
getObjectForIdpublic java.lang.Object getObjectForId(long id) Gets a known object by ID.- Specified by:
- getObjectForIdin interface- IDecodingContext
- Parameters:
- id- The ID.
- Returns:
- The object or null.
 
 - 
setObjectForIdpublic void setObjectForId(long id, java.lang.Object object)Sets a known object by ID.- Specified by:
- setObjectForIdin interface- IDecodingContext
- Parameters:
- id- The ID.
- object- The object..
 
 - 
getObjectIdpublic java.lang.Long getObjectId(java.lang.Object object) Gets the ID of a known object.- Specified by:
- getObjectIdin interface- IDecodingContext
- Parameters:
- object- The object
- Returns:
- The ID.
 
 - 
getUserContextpublic java.lang.Object getUserContext() Returns the user context.- Specified by:
- getUserContextin interface- IUserContextContainer
- Returns:
- The user context.
 
 - 
getErrorReporterpublic IErrorReporter getErrorReporter() Gets the error reporter.- Specified by:
- getErrorReporterin interface- IDecodingContext
- Returns:
- The error reporter.
 
 - 
getLastObjectpublic java.lang.Object getLastObject() Returns the last object decoded.- Specified by:
- getLastObjectin interface- IDecodingContext
- Returns:
- The last object decoded.
 
 - 
setLastObjectpublic void setLastObject(java.lang.Object lastobject) Sets the last object decoded.- Specified by:
- setLastObjectin interface- IDecodingContext
- Parameters:
- lastobject- The last object decoded.
 
 - 
readBooleanpublic boolean readBoolean() Reads a boolean value from the buffer.- Specified by:
- readBooleanin interface- IDecodingContext
- Returns:
- Boolean value.
 
 - 
readStringpublic java.lang.String readString() Helper method for decoding a string.- Specified by:
- readStringin interface- IDecodingContext
- Returns:
- String encoded at the current position.
 
 - 
readVarIntpublic long readVarInt() Helper method for decoding a variable-sized integer (VarInt).- Specified by:
- readVarIntin interface- IDecodingContext
- Returns:
- The decoded value.
 
 - 
readSignedVarIntpublic long readSignedVarInt() Helper method for decoding a signed variable-sized integer (VarInt).- Specified by:
- readSignedVarIntin interface- IDecodingContext
- Returns:
- The decoded value.
 
 - 
readClassnamepublic java.lang.String readClassname() Helper method for decoding a class name.- Specified by:
- readClassnamein interface- IDecodingContext
- Returns:
- String encoded at the current position.
 
 - 
pooledReadpublic java.lang.String pooledRead(java.util.List<java.lang.String> pool) Readsa a string using a pool.- Parameters:
- pool- The pool.
- Returns:
- The string.
 
 - 
getCurrentClassNamepublic java.lang.String getCurrentClassName() Gets the current class name.- Specified by:
- getCurrentClassNamein interface- IDecodingContext
- Returns:
- The current class name.
 
 - 
setCurrentClassNameprotected void setCurrentClassName(java.lang.String currentclassname) Sets the current class name.
 - 
setVersionpublic void setVersion(int version) Sets the format version.- Specified by:
- setVersionin interface- IDecodingContext
- Parameters:
- version- The version.
 
 - 
startObjectFramepublic void startObjectFrame() Starts an object frame when using a context with framing support.
 - 
startObjectFramepublic void startObjectFrame(boolean fixedsize) Starts an object frame when using a context with framing support.- Specified by:
- startObjectFramein interface- IDecodingContext
- 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).
 
 - 
stopObjectFramepublic void stopObjectFrame() Stops an object frame when using a context with framing support.- Specified by:
- stopObjectFramein interface- IDecodingContext
 
 - 
readpublic abstract byte[] read(int count) Reads a number of bytes from the buffer.- Parameters:
- count- Number of bytes.
- Returns:
- Byte array with the bytes.
 
 - 
readpublic abstract byte[] read(byte[] array) Reads a number of bytes from the buffer and fills the array.- Specified by:
- readin interface- IDecodingContext
- Parameters:
- array- The byte array.
- Returns:
- The byte array for convenience.
 
 - 
readpublic abstract byte[] read(byte[] array, int woffset, int wlength)Reads a number of bytes from the buffer and fills the array.- Parameters:
- array- The byte array.
- woffset- write offset.
- wlength- length to read.
- Returns:
- The byte array for convenience.
 
 
- 
 
-