Package jadex.binary

Class FramingEncodingContext

    • 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:
        startObjectFrame in interface IEncodingContext
        Overrides:
        startObjectFrame in class AbstractEncodingContext
        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).
      • writeByte

        public void writeByte​(byte b)
        Description copied from interface: IEncodingContext
        Writes a byte.
        Parameters:
        b - The byte.
      • write

        public void write​(byte[] b)
        Description copied from interface: IEncodingContext
        Writes 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.