Interface Serializer<S>

  • Type Parameters:
    S - the type of the object that will be serialized
    All Known Implementing Classes:
    DefaultSerializer, StringSerializer

    public interface Serializer<S>
    A strategy interface for serializing objects of type S into a byte array.

    Implementations of this interface must be thread-safe and should also ensure that the serialization process is consistent and efficient.

    Example Usage

    
     public class StringSerializer implements Serializer&lt;String&gt; {
         public byte[] serialize(String source) throws IOException {
             return source.getBytes(StandardCharsets.UTF_8);
         }
     }
     
    Since:
    1.0.0
    Author:
    Mercy
    • Method Detail

      • serialize

        byte[] serialize​(S source)
                  throws java.io.IOException
        Throws:
        java.io.IOException