Class JadexBinarySerializer

java.lang.Object
jadex.serialization.serializers.JadexBinarySerializer
All Implemented Interfaces:
ISerializer

public class JadexBinarySerializer extends Object implements ISerializer
The Jadex Binary serializer. Codec supports parallel calls of multiple concurrent clients (no method synchronization necessary). Converts object -> byte[] and byte[] -> object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static jadex.binary.SerializationConfig
    Config with pre-defined Strings for faster encoding/decoding.
    protected boolean
    The debug flag.
    List<jadex.binary.IDecoderHandler>
    The read processors.
    static final int
    The JadexBinary serializer id.
    List<jadex.common.transformation.traverser.ITraverseProcessor>
    The write processors.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new serializer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addProcessor(jadex.binary.IDecoderHandler readproc, jadex.common.transformation.traverser.ITraverseProcessor writeproc)
    Add a processor pair.
    decode(byte[] bytes, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
    Decode an object.
    decode(InputStream is, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep)
    Decode an object.
    decode(InputStream is, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
    Decode an object.
    void
    encode(OutputStream os, Object val, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] preprocs, Object usercontext)
    Encode data with the serializer.
    byte[]
    encode(Object val, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] preprocs, Object usercontext)
    Encode data with the serializer.
    int
    Get the serializer id.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SERIALIZER_ID

      public static final int SERIALIZER_ID
      The JadexBinary serializer id.
      See Also:
    • DEBUG

      protected boolean DEBUG
      The debug flag.
    • CONFIG

      protected static jadex.binary.SerializationConfig CONFIG
      Config with pre-defined Strings for faster encoding/decoding.
    • writeprocs

      public List<jadex.common.transformation.traverser.ITraverseProcessor> writeprocs
      The write processors.
    • readprocs

      public List<jadex.binary.IDecoderHandler> readprocs
      The read processors.
  • Constructor Details

    • JadexBinarySerializer

      public JadexBinarySerializer()
      Create a new serializer.
  • Method Details

    • getSerializerId

      public int getSerializerId()
      Get the serializer id.
      Specified by:
      getSerializerId in interface ISerializer
      Returns:
      The serializer id.
    • encode

      public byte[] encode(Object val, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] preprocs, Object usercontext)
      Encode data with the serializer.
      Parameters:
      val - The value.
      classloader - The classloader.
      preproc - The encoding preprocessors.
      Returns:
      The encoded object.
    • encode

      public void encode(OutputStream os, Object val, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] preprocs, Object usercontext)
      Encode data with the serializer.
      Specified by:
      encode in interface ISerializer
      Parameters:
      os - The output stream for writing.
      val - The value.
      classloader - The classloader.
      preproc - The encoding preprocessors.
    • decode

      public Object decode(byte[] bytes, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
      Decode an object.
      Returns:
      The decoded object.
    • decode

      public Object decode(InputStream is, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep)
      Decode an object.
      Returns:
      The decoded object.
    • decode

      public Object decode(InputStream is, ClassLoader classloader, jadex.common.transformation.traverser.ITraverseProcessor[] postprocs, jadex.common.transformation.traverser.IErrorReporter rep, Object usercontext)
      Decode an object.
      Specified by:
      decode in interface ISerializer
      Returns:
      The decoded object.
      Throws:
      IOException
    • addProcessor

      public void addProcessor(jadex.binary.IDecoderHandler readproc, jadex.common.transformation.traverser.ITraverseProcessor writeproc)
      Add a processor pair.