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

public class StreamDecodingContext extends AbstractDecodingContext
Context for decoding a binary-encoded object.
  • Field Details

    • is

      protected InputStream is
      The stream being decoded.
    • offset

      protected int offset
      Current 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 class AbstractDecodingContext
      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 interface IDecodingContext
      Specified by:
      read in class AbstractDecodingContext
      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 class AbstractDecodingContext
      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.