Interface Serializer

All Known Implementing Classes:
BooleanSerializer, ByteArraySerializer, ByteSerializer, CharacterSerializer, DisabledSerializer, DoubleSerializer, FloatSerializer, IntegerSerializer, JacksonJsonSerializer, JavaSerializer, LongSerializer, NullSerializer, ProtobufSerializer, ShortSerializer, StringSerializer

public interface Serializer
A Serializer represents a bimap between an object and an array of bytes representing that object.

Make sure that your implementation implements the standard constructor!

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    fromByteArray(byte[] bytes, Class<T> type)
    Produces an object of type T from an array of bytes.
    default Object
    fromByteArray(byte[] bytes, String typeName)
     
    byte[]
    Serializes the given object into an array of bytes
  • Method Details

    • toByteArray

      byte[] toByteArray(Object o) throws IOException
      Serializes the given object into an array of bytes
      Throws:
      IOException - if deserialization to byte array fails
    • fromByteArray

      <T> T fromByteArray(byte[] bytes, Class<T> type) throws IOException
      Produces an object of type T from an array of bytes.
      Throws:
      IOException - if serialization to byte array fails
    • fromByteArray

      default Object fromByteArray(byte[] bytes, String typeName) throws IOException
      Throws:
      IOException