Interface Deserializer<T>

  • Type Parameters:
    T - the type to be deserialized from a byte array
    All Known Implementing Classes:
    DefaultDeserializer, StringDeserializer
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Deserializer<T>
    A functional interface for deserializing byte arrays into objects of type T.

    Implementations of this interface must be thread-safe.

    Example Usage

    
     Deserializer<String> deserializer = bytes -> new String(bytes, StandardCharsets.UTF_8);
     String data = deserializer.deserialize("Hello, World!".getBytes(StandardCharsets.UTF_8));
     System.out.println(data); // Output: Hello, World!
     

    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    Serializer
    • Method Detail

      • deserialize

        T deserialize​(byte[] bytes)
               throws java.io.IOException
        Throws:
        java.io.IOException