public class InstantCoder extends AtomicCoder<org.joda.time.Instant>
Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
boolean |
consistentWithEquals()
Returns true if whenever the encoded bytes of two values are equal, then the original values
are equal according to
Objects.equals() (note that this is well-defined for
null). |
org.joda.time.Instant |
decode(InputStream inStream,
Coder.Context context)
Decodes a value of type
T from the given input stream in
the given context. |
void |
encode(org.joda.time.Instant value,
OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream
in the given context. |
boolean |
isRegisterByteSizeObserverCheap(org.joda.time.Instant value,
Coder.Context context)
StandardCoder requires elements to be fully encoded and copied
into a byte stream to determine the byte size of the element, which is
considered expensive. |
static InstantCoder |
of() |
void |
registerByteSizeObserver(org.joda.time.Instant value,
com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer,
Coder.Context context)
Notifies
observer about the byte size of the encoded value using this coder. |
getCoderArguments, getInstanceComponentsverifyDeterministicasCloudObject, equals, getAllowedEncodings, getComponents, getEncodedElementByteSize, getEncodingId, hashCode, structuralValue, toString, verifyDeterministic, verifyDeterministicpublic static InstantCoder of()
public void encode(org.joda.time.Instant 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 org.joda.time.Instant 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 boolean consistentWithEquals()
CoderObjects.equals() (note that this is well-defined for
null). In other words, encoding is injective.
This condition is most notably false for arrays. More generally, this condition is false
whenever equals() compares object identity, rather than performing a
semantic/structural comparison.
consistentWithEquals in interface Coder<org.joda.time.Instant>consistentWithEquals in class StandardCoder<org.joda.time.Instant>public boolean isRegisterByteSizeObserverCheap(org.joda.time.Instant value,
Coder.Context context)
StandardCoderStandardCoder requires elements to be fully encoded and copied
into a byte stream to determine the byte size of the element, which is
considered expensive.isRegisterByteSizeObserverCheap in interface Coder<org.joda.time.Instant>isRegisterByteSizeObserverCheap in class StandardCoder<org.joda.time.Instant>public void registerByteSizeObserver(org.joda.time.Instant value,
com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer,
Coder.Context context)
throws Exception
StandardCoderobserver about the byte size of the encoded value using this coder.
Calls StandardCoder.getEncodedElementByteSize(T, com.google.cloud.dataflow.sdk.coders.Coder.Context) and notifies observer using
ElementByteSizeObserver.update(Object).registerByteSizeObserver in interface Coder<org.joda.time.Instant>registerByteSizeObserver in class StandardCoder<org.joda.time.Instant>Exception