T - the type of elements handled by this coderpublic class SerializableCoder<T extends java.io.Serializable> extends CustomCoder<T>
Coder for Java classes that implement Serializable.
 To use, specify the coder type on a PCollection:
 
   PCollection<MyRecord> records =
       foo.apply(...).setCoder(SerializableCoder.of(MyRecord.class));
 
 
 SerializableCoder does not guarantee a deterministic encoding, as Java
 serialization may produce different binary encodings for two equivalent
 objects.
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
SerializableCoder.SerializableCoderProviderRegistrar
A  
CoderProviderRegistrar which registers a CoderProvider which can handle
 serializable types. | 
Coder.Context, Coder.NonDeterministicException| Modifier | Constructor and Description | 
|---|---|
protected  | 
SerializableCoder(java.lang.Class<T> type,
                 TypeDescriptor<T> typeDescriptor)  | 
| Modifier and Type | Method and Description | 
|---|---|
T | 
decode(java.io.InputStream inStream)
Decodes a value of type  
T from the given input stream in
 the given context. | 
void | 
encode(T value,
      java.io.OutputStream outStream)
Encodes the given value of type  
T onto the given output stream. | 
boolean | 
equals(java.lang.Object other)  | 
static CoderProvider | 
getCoderProvider()
Returns a  
CoderProvider which uses the SerializableCoder if possible for
 all types. | 
TypeDescriptor<T> | 
getEncodedTypeDescriptor()
Returns the  
TypeDescriptor for the type encoded. | 
java.lang.Class<T> | 
getRecordType()  | 
int | 
hashCode()  | 
static <T extends java.io.Serializable> | 
of(java.lang.Class<T> clazz)
Returns a  
SerializableCoder instance for the provided element class. | 
static <T extends java.io.Serializable> | 
of(TypeDescriptor<T> type)
Returns a  
SerializableCoder instance for the provided element type. | 
void | 
verifyDeterministic()
Throw  
Coder.NonDeterministicException if the coding is not deterministic. | 
getCoderArgumentsconsistentWithEquals, decode, encode, getEncodedElementByteSize, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministicprotected SerializableCoder(java.lang.Class<T> type, TypeDescriptor<T> typeDescriptor)
public static <T extends java.io.Serializable> SerializableCoder<T> of(TypeDescriptor<T> type)
SerializableCoder instance for the provided element type.T - the element typepublic static <T extends java.io.Serializable> SerializableCoder<T> of(java.lang.Class<T> clazz)
SerializableCoder instance for the provided element class.T - the element typepublic static CoderProvider getCoderProvider()
CoderProvider which uses the SerializableCoder if possible for
 all types.
 This method is invoked reflectively from DefaultCoder.
public java.lang.Class<T> getRecordType()
public void encode(T value, java.io.OutputStream outStream) throws java.io.IOException, CoderException
CoderT onto the given output stream.encode in class Coder<T extends java.io.Serializable>java.io.IOException - if writing to the OutputStream fails
 for some reasonCoderException - if the value could not be encoded for some reasonpublic T decode(java.io.InputStream inStream) throws java.io.IOException, CoderException
CoderT from the given input stream in
 the given context.  Returns the decoded value.decode in class Coder<T extends java.io.Serializable>java.io.IOException - if reading from the InputStream fails
 for some reasonCoderException - if the value could not be decoded for some reasonpublic void verifyDeterministic()
                         throws Coder.NonDeterministicException
Coder.NonDeterministicException if the coding is not deterministic.
 In order for a Coder to be considered deterministic,
 the following must be true:
 
Object.equals()
       or Comparable.compareTo(), if supported) have the same
       encoding.
   Coder always produces a canonical encoding, which is the
       same for an instance of an object even if produced on different
       computers at different times.
 verifyDeterministic in class CustomCoder<T extends java.io.Serializable>NonDeterministicException - always. Java serialization is not
         deterministic with respect to Object.equals(java.lang.Object) for all types.Coder.NonDeterministicException - if this coder is not deterministic.public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic TypeDescriptor<T> getEncodedTypeDescriptor()
CoderTypeDescriptor for the type encoded.getEncodedTypeDescriptor in class Coder<T extends java.io.Serializable>