public class VarLongCoder extends AtomicCoder<java.lang.Long>
Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
java.lang.Long |
decode(java.io.InputStream inStream,
Coder.Context context)
Decodes a value of type
T from the given input stream in
the given context. |
void |
encode(java.lang.Long value,
java.io.OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream
in the given context. |
protected long |
getEncodedElementByteSize(java.lang.Long value,
Coder.Context context)
Returns the size in bytes of the encoded value using this
coder.
|
boolean |
isDeterministic()
Deprecated.
|
boolean |
isRegisterByteSizeObserverCheap(java.lang.Long value,
Coder.Context context)
Returns true since registerByteSizeObserver() runs in constant time.
|
static VarLongCoder |
of() |
void |
verifyDeterministic()
Throw
Coder.NonDeterministicException if the coding is not deterministic. |
getCoderArguments, getInstanceComponentsasCloudObject, equals, getComponents, hashCode, registerByteSizeObserver, toString, verifyDeterministic, verifyDeterministicpublic static VarLongCoder of()
public void encode(java.lang.Long value,
java.io.OutputStream outStream,
Coder.Context context)
throws java.io.IOException,
CoderException
CoderT onto the given output stream
in the given context.java.io.IOException - if writing to the OutputStream fails
for some reasonCoderException - if the value could not be encoded for some reasonpublic java.lang.Long decode(java.io.InputStream inStream,
Coder.Context context)
throws java.io.IOException,
CoderException
CoderT from the given input stream in
the given context. Returns the decoded value.java.io.IOException - if reading from the InputStream fails
for some reasonCoderException - if the value could not be decoded for some reason@Deprecated public boolean isDeterministic()
Coder 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.
public void verifyDeterministic()
CoderCoder.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 interface Coder<java.lang.Long>verifyDeterministic in class StandardCoder<java.lang.Long>public boolean isRegisterByteSizeObserverCheap(java.lang.Long value,
Coder.Context context)
isRegisterByteSizeObserverCheap in interface Coder<java.lang.Long>isRegisterByteSizeObserverCheap in class StandardCoder<java.lang.Long>protected long getEncodedElementByteSize(java.lang.Long value,
Coder.Context context)
throws java.lang.Exception
StandardCodergetEncodedElementByteSize in class StandardCoder<java.lang.Long>java.lang.Exception