Interface ICodec


  • public interface ICodec
    Encode and decode an object from a string representation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CODEC_ID
      Constant for accessing the codec id.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] decode​(byte[] bytes)
      Decode data with the codec.
      byte[] decode​(byte[] bytes, int offset, int length)
      Decode data with the codec.
      byte[] encode​(byte[] val)
      Encode data with the codec.
      int getCodecId()
      Get the codec id.
    • Field Detail

      • CODEC_ID

        static final java.lang.String CODEC_ID
        Constant for accessing the codec id.
        See Also:
        Constant Field Values
    • Method Detail

      • getCodecId

        int getCodecId()
        Get the codec id.
        Returns:
        The codec id.
      • encode

        byte[] encode​(byte[] val)
        Encode data with the codec.
        Parameters:
        val - The value.
        Returns:
        The encoded object.
      • decode

        byte[] decode​(byte[] bytes)
        Decode data with the codec.
        Parameters:
        bytes - The value bytes as byte array or input stream.
        Returns:
        The decoded object or byte array (for intermediate codecs).
      • decode

        byte[] decode​(byte[] bytes,
                      int offset,
                      int length)
        Decode data with the codec.
        Parameters:
        bytes - The value bytes as byte array or input stream.
        Returns:
        The decoded object or byte array (for intermediate codecs).