Interface Codec

All Known Implementing Classes:
Codecs.AbstractCodec, Codecs.ArrayCodec, Codecs.CollectionCodec, Codecs.DefaultCodec, Codecs.LongArrayCodec, Codecs.MapCodec

public interface Codec
A Codec provides an interception point for any specific code that needs to be executed pre or post (de)serialization. In the case of deserialization this could be to return a concrete implementation and with serialization this could be to explicitly call a specific method on PofWriter that is not carried out by PofWriter.writeObject(int, Object).
Since:
3.7.1
Author:
hr
  • Method Details

    • decode

      Object decode(PofReader in, int iProp) throws IOException
      Deserialize an object from the provided PofReader. Implementing this interface allows introducing specific return implementations.
      Parameters:
      in - the PofReader to read from
      iProp - the index of the POF property to deserialize
      Returns:
      a specific implementation of the POF property
      Throws:
      IOException - if an I/O error occurs
    • encode

      void encode(PofWriter out, int iProp, Object value) throws IOException
      Serialize an object using the provided PofWriter.
      Parameters:
      out - the PofWriter to read from
      iProp - the index of the POF property to serialize
      value - the value to serialize
      Throws:
      IOException - if an I/O error occurs