Class ListSerializer<T>

  • Type Parameters:
    T - The type of element in the list.
    All Implemented Interfaces:
    Serializable

    public final class ListSerializer<T>
    extends org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
    A serializer for Lists. The serializer relies on an element serializer for the serialization of the list's elements.

    The serialization format for the list is as follows: four bytes for the length of the lost, followed by the serialized representation of each element.

    See Also:
    Serialized Form
    • Constructor Detail

      • ListSerializer

        public ListSerializer​(org.apache.flink.api.common.typeutils.TypeSerializer<T> elementSerializer)
        Creates a list serializer that uses the given serializer to serialize the list's elements.
        Parameters:
        elementSerializer - The serializer for the elements of the list
    • Method Detail

      • getElementSerializer

        public org.apache.flink.api.common.typeutils.TypeSerializer<T> getElementSerializer()
        Gets the serializer for the elements of the list.
        Returns:
        The serializer for the elements of the list
      • isImmutableType

        public boolean isImmutableType()
        Specified by:
        isImmutableType in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • duplicate

        public org.apache.flink.api.common.typeutils.TypeSerializer<List<T>> duplicate()
        Specified by:
        duplicate in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • createInstance

        public List<T> createInstance()
        Specified by:
        createInstance in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • copy

        public List<T> copy​(List<T> from)
        Specified by:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • copy

        public List<T> copy​(List<T> from,
                            List<T> reuse)
        Specified by:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • getLength

        public int getLength()
        Specified by:
        getLength in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • serialize

        public void serialize​(List<T> list,
                              org.apache.flink.core.memory.DataOutputView target)
                       throws IOException
        Specified by:
        serialize in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
        Throws:
        IOException
      • deserialize

        public List<T> deserialize​(org.apache.flink.core.memory.DataInputView source)
                            throws IOException
        Specified by:
        deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
        Throws:
        IOException
      • deserialize

        public List<T> deserialize​(List<T> reuse,
                                   org.apache.flink.core.memory.DataInputView source)
                            throws IOException
        Specified by:
        deserialize in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
        Throws:
        IOException
      • copy

        public void copy​(org.apache.flink.core.memory.DataInputView source,
                         org.apache.flink.core.memory.DataOutputView target)
                  throws IOException
        Specified by:
        copy in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
        Throws:
        IOException
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>
      • snapshotConfiguration

        public org.apache.flink.api.common.typeutils.TypeSerializerSnapshot<List<T>> snapshotConfiguration()
        Specified by:
        snapshotConfiguration in class org.apache.flink.api.common.typeutils.TypeSerializer<List<T>>