Class SimpleDatatypeCodecs.ByteArrayCodec

  • All Implemented Interfaces:
    DatatypeCodec<byte[]>
    Enclosing class:
    SimpleDatatypeCodecs

    public static class SimpleDatatypeCodecs.ByteArrayCodec
    extends Object
    implements DatatypeCodec<byte[]>

    Datatype codec for byte[]. This codec may be useful in a collection-type datatype codec annotation such as ListCodecType when the underlying collection stores byte array objects.

    Since:
    Rhino 2.4.0
    • Constructor Detail

      • ByteArrayCodec

        public ByteArrayCodec()
    • Method Detail

      • encode

        public void encode​(byte[] value,
                           DataOutput out,
                           EncoderUtils utils)
                    throws IOException
        Description copied from interface: DatatypeCodec

        Encode the specified value to the given data output stream.

        Specified by:
        encode in interface DatatypeCodec<byte[]>
        Parameters:
        value - the value to encode. This will never be null.
        out - the data output stream to encode the value to.
        utils - additional utility encoding functions that may be useful to the codec.
        Throws:
        IOException - if an I/O error occurs.
      • decode

        public byte[] decode​(DataInput in,
                             ClassLoader cl,
                             DecoderUtils utils)
                      throws IOException
        Description copied from interface: DatatypeCodec

        Decode a value from the given data input stream.

        Specified by:
        decode in interface DatatypeCodec<byte[]>
        Parameters:
        in - the data input stream to decode the value from.
        cl - a classloader which can be used to load classes necessary to decode the value.
        utils - additional utility decoding functions that may be useful to the codec.
        Returns:
        the decoded value.
        Throws:
        IOException - if an I/O error occurs.