public class TextualIntegerCoder extends AtomicCoder<java.lang.Integer>
Coder
that encodes Integer Integers
as the ASCII bytes of their textual,
decimal, representation.Coder.Context, Coder.NonDeterministicException
Modifier | Constructor and Description |
---|---|
protected |
TextualIntegerCoder() |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
decode(java.io.InputStream inStream)
Decodes a value of type
T from the given input stream in the given context. |
java.lang.Integer |
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.Integer value,
java.io.OutputStream outStream)
Encodes the given value of type
T onto the given output stream. |
void |
encode(java.lang.Integer 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.Integer value)
Returns the size in bytes of the encoded value using this coder.
|
TypeDescriptor<java.lang.Integer> |
getEncodedTypeDescriptor()
Returns the
TypeDescriptor for the type encoded. |
static TextualIntegerCoder |
of() |
void |
verifyDeterministic()
Throw
Coder.NonDeterministicException if the coding is not deterministic. |
equals, getCoderArguments, getComponents, hashCode
toString
consistentWithEquals, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministic
public static TextualIntegerCoder of()
public void encode(java.lang.Integer value, java.io.OutputStream outStream) throws java.io.IOException, CoderException
Coder
T
onto the given output stream.encode
in class Coder<java.lang.Integer>
java.io.IOException
- if writing to the OutputStream
fails for some reasonCoderException
- if the value could not be encoded for some reasonpublic void encode(java.lang.Integer value, java.io.OutputStream outStream, Coder.Context context) throws java.io.IOException, CoderException
Coder
T
onto the given output stream in the given context.encode
in class Coder<java.lang.Integer>
java.io.IOException
- if writing to the OutputStream
fails for some reasonCoderException
- if the value could not be encoded for some reasonpublic java.lang.Integer decode(java.io.InputStream inStream) throws java.io.IOException, CoderException
Coder
T
from the given input stream in the given context. Returns the
decoded value.decode
in class Coder<java.lang.Integer>
java.io.IOException
- if reading from the InputStream
fails for some reasonCoderException
- if the value could not be decoded for some reasonpublic java.lang.Integer decode(java.io.InputStream inStream, Coder.Context context) throws java.io.IOException, CoderException
Coder
T
from the given input stream in the given context. Returns the
decoded value.decode
in class Coder<java.lang.Integer>
java.io.IOException
- if reading from the InputStream
fails for some reasonCoderException
- if the value could not be decoded for some reasonpublic void verifyDeterministic()
AtomicCoder
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.
Unless overridden, does not throw. An AtomicCoder
is presumed to be deterministic
verifyDeterministic
in class AtomicCoder<java.lang.Integer>
public TypeDescriptor<java.lang.Integer> getEncodedTypeDescriptor()
Coder
TypeDescriptor
for the type encoded.getEncodedTypeDescriptor
in class Coder<java.lang.Integer>
protected long getEncodedElementByteSize(java.lang.Integer value) throws java.lang.Exception
Coder
getEncodedElementByteSize
in class Coder<java.lang.Integer>
java.lang.Exception