Class KryoCoder<T>
- java.lang.Object
-
- org.apache.beam.sdk.coders.Coder<T>
-
- org.apache.beam.sdk.coders.CustomCoder<T>
-
- org.apache.beam.sdk.extensions.kryo.KryoCoder<T>
-
- Type Parameters:
T- type of element coder can handle
- All Implemented Interfaces:
java.io.Serializable
public class KryoCoder<T> extends org.apache.beam.sdk.coders.CustomCoder<T>Coder using Kryo as (de)serialization mechanism. SeeKryoCoderProviderto get more details about usage.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tdecode(java.io.InputStream inStream)voidencode(T value, java.io.OutputStream outStream)booleanequals(@Nullable java.lang.Object other)inthashCode()static <T> KryoCoder<T>of()Create a newKryoCoderwith defaultKryoOptions.static <T> KryoCoder<T>of(java.util.List<KryoRegistrar> registrars)Create a newKryoCoderwith defaultKryoOptions.static <T> KryoCoder<T>of(KryoRegistrar... registrars)Create a newKryoCoderwith defaultKryoOptions.static <T> KryoCoder<T>of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions)Create a newKryoCoder.static <T> KryoCoder<T>of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions, java.util.List<KryoRegistrar> registrars)Create a newKryoCoder.static <T> KryoCoder<T>of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions, KryoRegistrar... registrars)Create a newKryoCoder.voidverifyDeterministic()KryoCoder<T>withRegistrar(KryoRegistrar registrar)Create a newKryoCoderinstance with the user provided registrar.
-
-
-
Method Detail
-
of
public static <T> KryoCoder<T> of()
Create a newKryoCoderwith defaultKryoOptions.
-
of
public static <T> KryoCoder<T> of(KryoRegistrar... registrars)
Create a newKryoCoderwith defaultKryoOptions.- Type Parameters:
T- type of element this class should decode/encodeKryoinstance used by returnedKryoCoder- Parameters:
registrars-KryoRegistrars which are used to register classes with underlying kryo instance- Returns:
- Newly created a
KryoCoder
-
of
public static <T> KryoCoder<T> of(java.util.List<KryoRegistrar> registrars)
Create a newKryoCoderwith defaultKryoOptions.- Type Parameters:
T- type of element this class should decode/encodeKryoinstance used by returnedKryoCoder- Parameters:
registrars-KryoRegistrars which are used to register classes with underlying kryo instance- Returns:
- Newly created a
KryoCoder
-
of
public static <T> KryoCoder<T> of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions)
Create a newKryoCoder.- Type Parameters:
T- type of element this class should decode/encodeKryoinstance used by returnedKryoCoder- Parameters:
pipelineOptions- Options used for coder setup. SeeKryoOptionsfor more details.- Returns:
- Newly created a
KryoCoder
-
of
public static <T> KryoCoder<T> of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions, KryoRegistrar... registrars)
Create a newKryoCoder.- Type Parameters:
T- type of element this class should decode/encodeKryoinstance used by returnedKryoCoder- Parameters:
pipelineOptions- Options used for coder setup. SeeKryoOptionsfor more details.registrars-KryoRegistrars which are used to register classes with underlying kryo instance- Returns:
- Newly created a
KryoCoder
-
of
public static <T> KryoCoder<T> of(org.apache.beam.sdk.options.PipelineOptions pipelineOptions, java.util.List<KryoRegistrar> registrars)
Create a newKryoCoder.- Type Parameters:
T- type of element this class should decode/encodeKryoinstance used by returnedKryoCoder- Parameters:
pipelineOptions- Options used for coder setup. SeeKryoOptionsfor more details.registrars-KryoRegistrars which are used to register classes with underlying kryo instance- Returns:
- Newly created a
KryoCoder
-
encode
public void encode(T value, java.io.OutputStream outStream) throws java.io.IOException
- Specified by:
encodein classorg.apache.beam.sdk.coders.Coder<T>- Throws:
java.io.IOException
-
decode
public T decode(java.io.InputStream inStream) throws java.io.IOException
- Specified by:
decodein classorg.apache.beam.sdk.coders.Coder<T>- Throws:
java.io.IOException
-
verifyDeterministic
public void verifyDeterministic() throws org.apache.beam.sdk.coders.Coder.NonDeterministicException- Overrides:
verifyDeterministicin classorg.apache.beam.sdk.coders.CustomCoder<T>- Throws:
org.apache.beam.sdk.coders.Coder.NonDeterministicException
-
withRegistrar
public KryoCoder<T> withRegistrar(KryoRegistrar registrar)
Create a newKryoCoderinstance with the user provided registrar.- Parameters:
registrar- registrar to append to list of already registered registrars.- Returns:
- new kryo coder
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
-