T - type of JAXB annotated objects that will be serialized.public class JAXBCoder<T> extends AtomicCoder<T>
Class of the JAXB annotated object.Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.dataflow.sdk.util.CloudObject |
asCloudObject()
Returns the
CloudObject that represents this Coder. |
T |
decode(InputStream inStream,
Coder.Context context)
Decodes a value of type
T from the given input stream in
the given context. |
void |
encode(T value,
OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream
in the given context. |
String |
getEncodingId()
A unique identifier for the binary format written by
Coder.encode(T, java.io.OutputStream, com.google.cloud.dataflow.sdk.coders.Coder.Context). |
Class<T> |
getJAXBClass() |
static <T> JAXBCoder<T> |
of(Class<T> jaxbClass)
Create a coder for a given type of JAXB annotated objects.
|
static <T> JAXBCoder<T> |
of(String jaxbClassName)
Constructor for JSON deserialization only.
|
getCoderArguments, getInstanceComponentsverifyDeterministicconsistentWithEquals, equals, getAllowedEncodings, getComponents, getEncodedElementByteSize, hashCode, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, toString, verifyDeterministic, verifyDeterministicpublic static <T> JAXBCoder<T> of(Class<T> jaxbClass)
jaxbClass - the Class of the JAXB annotated objects.public void encode(T value, OutputStream outStream, Coder.Context context) throws CoderException, IOException
CoderT onto the given output stream
in the given context.CoderException - if the value could not be encoded for some reasonIOException - if writing to the OutputStream fails
for some reasonpublic T decode(InputStream inStream, Coder.Context context) throws CoderException, IOException
CoderT from the given input stream in
the given context. Returns the decoded value.CoderException - if the value could not be decoded for some reasonIOException - if reading from the InputStream fails
for some reasonpublic String getEncodingId()
StandardCoderCoder.encode(T, java.io.OutputStream, com.google.cloud.dataflow.sdk.coders.Coder.Context). If a subclass is
modified to write a new format, it is imperative that this method be overridden to return
a distinct value.
By default, this is an empty string so only the fully qualified name of the class is used.
getEncodingId in interface Coder<T>getEncodingId in class StandardCoder<T>StandardCoder.getAllowedEncodings()public static <T> JAXBCoder<T> of(String jaxbClassName)
public com.google.cloud.dataflow.sdk.util.CloudObject asCloudObject()
CoderCloudObject that represents this Coder.asCloudObject in interface Coder<T>asCloudObject in class StandardCoder<T>