IterableLikeCoder (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

Class IterableLikeCoder<T,IterableT extends Iterable<T>>

  • Type Parameters:
    T - the type of the elements of the Iterables being transcoded
    IterableT - the type of the Iterables being transcoded
    All Implemented Interfaces:
    Coder<IterableT>, Serializable
    Direct Known Subclasses:
    CollectionCoder, IterableCoder, ListCoder, SetCoder

    public abstract class IterableLikeCoder<T,IterableT extends Iterable<T>>
    extends StandardCoder<IterableT>
    An abstract base class with functionality for assembling a Coder for a class that implements Iterable.

    To complete a subclass, implement the decodeToIterable(java.util.List<T>) method. This superclass will decode the elements in the input stream into a List and then pass them to that method to be converted into the appropriate iterable type. Note that this means the input iterables must fit into memory.

    The format of this coder is as follows:

    • If the input Iterable has a known and finite size, then the size is written to the output stream in big endian format, followed by all of the encoded elements.
    • If the input Iterable is not known to have a finite size, then each element of the input is preceded by true encoded as a byte (indicating "more data") followed by the encoded element, and terminated by false encoded as a byte.

    See Also:
    Serialized Form