Class List.Cons.SerializationProxy<T>

java.lang.Object
io.vavr.collection.List.Cons.SerializationProxy<T>
Type Parameters:
T - The component type of the underlying list.
All Implemented Interfaces:
Serializable
Enclosing class:
List.Cons<T>

@GwtIncompatible("The Java serialization protocol is explicitly not supported") private static final class List.Cons.SerializationProxy<T> extends Object implements Serializable
A serialization proxy which, in this context, is used to deserialize immutable, linked Lists with final instance fields.
  • Field Details

  • Constructor Details

    • SerializationProxy

      SerializationProxy(List.Cons<T> list)
      Constructor for the case of serialization, called by List.Cons.writeReplace().

      The constructor of a SerializationProxy takes an argument that concisely represents the logical state of an instance of the enclosing class.

      Parameters:
      list - a Cons
  • Method Details

    • writeObject

      private void writeObject(ObjectOutputStream s) throws IOException
      Write an object to a serialization stream.
      Parameters:
      s - An object serialization stream.
      Throws:
      IOException - If an error occurs writing to the stream.
    • readObject

      private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException
      Read an object from a deserialization stream.
      Parameters:
      s - An object deserialization stream.
      Throws:
      ClassNotFoundException - If the object's class read from the stream cannot be found.
      InvalidObjectException - If the stream contains no list elements.
      IOException - If an error occurs reading from the stream.
    • readResolve

      private Object readResolve()
      readResolve method for the serialization proxy pattern.

      Returns a logically equivalent instance of the enclosing class. The presence of this method causes the serialization system to translate the serialization proxy back into an instance of the enclosing class upon deserialization.

      Returns:
      A deserialized instance of the enclosing class.