Interface Codec


  • public interface Codec
    Encode objects stored as FSM input associated objects to a byte[] form and vice versa.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object decode​(byte[] value)
      Decode a byte[] form of an object back into the corresponding object.
      Object decode​(byte[] value, ClassLoader cl)
      Decode a byte[] form of an object back into the corresponding object using the class loader passed.
      byte[] encode​(Object value)
      Encode an object to a byte[] form.
    • Method Detail

      • encode

        byte[] encode​(Object value)
               throws IOException
        Encode an object to a byte[] form.
        Parameters:
        value - the value to convert. A null value will be encoded.
        Returns:
        a byte[] encoded form of the object
        Throws:
        IOException - if the object cannot be converted.
      • decode

        Object decode​(byte[] value)
               throws IOException
        Decode a byte[] form of an object back into the corresponding object.
        Parameters:
        value - the value to convert. This value will never be null.
        Returns:
        an object form of the byte[] value. Will return null if the encoded value was null.
        Throws:
        IOException - if the byte[] value cannot be converted into an object.
      • decode

        Object decode​(byte[] value,
                      ClassLoader cl)
               throws IOException
        Decode a byte[] form of an object back into the corresponding object using the class loader passed.
        Parameters:
        value - the value to convert. This value will never be null.
        cl - the class loader to use when decoding
        Returns:
        an object form of the byte[] value. Will return null if the encoded value was null.
        Throws:
        IOException - if the byte[] value cannot be converted into an object.