T - the type of elements handled by this coder.public class WritableCoder<T extends org.apache.hadoop.io.Writable>
extends org.apache.beam.sdk.coders.CustomCoder<T>
WritableCoder is a Coder for a Java class that implements Writable.
To use, specify the coder type on a PCollection:
PCollection<MyRecord> records =
foo.apply(...).setCoder(WritableCoder.of(MyRecord.class));
| Modifier and Type | Class and Description |
|---|---|
static class |
WritableCoder.WritableCoderProviderRegistrar
A
CoderProviderRegistrar which registers a CoderProvider which can handle
writable types. |
| Constructor and Description |
|---|
WritableCoder(java.lang.Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
T |
decode(java.io.InputStream inStream) |
void |
encode(T value,
java.io.OutputStream outStream) |
boolean |
equals(@Nullable java.lang.Object other) |
java.util.List<org.apache.beam.sdk.coders.Coder<?>> |
getCoderArguments() |
static org.apache.beam.sdk.coders.CoderProvider |
getCoderProvider()
|
int |
hashCode() |
static <T extends org.apache.hadoop.io.Writable> |
of(java.lang.Class<T> clazz)
Returns a
WritableCoder instance for the provided element class. |
void |
verifyDeterministic() |
public WritableCoder(java.lang.Class<T> type)
public static <T extends org.apache.hadoop.io.Writable> WritableCoder<T> of(java.lang.Class<T> clazz)
WritableCoder instance for the provided element class.T - the element typepublic void encode(T value, java.io.OutputStream outStream) throws java.io.IOException
encode in class org.apache.beam.sdk.coders.Coder<T extends org.apache.hadoop.io.Writable>java.io.IOExceptionpublic T decode(java.io.InputStream inStream) throws java.io.IOException
decode in class org.apache.beam.sdk.coders.Coder<T extends org.apache.hadoop.io.Writable>java.io.IOExceptionpublic java.util.List<org.apache.beam.sdk.coders.Coder<?>> getCoderArguments()
getCoderArguments in class org.apache.beam.sdk.coders.CustomCoder<T extends org.apache.hadoop.io.Writable>public void verifyDeterministic()
throws org.apache.beam.sdk.coders.Coder.NonDeterministicException
verifyDeterministic in class org.apache.beam.sdk.coders.CustomCoder<T extends org.apache.hadoop.io.Writable>org.apache.beam.sdk.coders.Coder.NonDeterministicExceptionpublic boolean equals(@Nullable java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static org.apache.beam.sdk.coders.CoderProvider getCoderProvider()
CoderProvider which uses the WritableCoder for Hadoop writable types.
This method is invoked reflectively from DefaultCoder.