Enum Class Codecs.Termination
- All Implemented Interfaces:
Serializable, Comparable<Codecs.Termination>, Constable
- Enclosing class:
Codecs
Policy for decoding a value whose terminator is absent at the end of the stream.
Encoding always writes the terminator regardless of this setting, so decoding an
unterminated final value and re-encoding it adds one. Use RecordingCodec when the
original bytes must be preserved exactly.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic Codecs.TerminationReturns the enum constant of this class with the specified name.static Codecs.Termination[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OPTIONAL
A final value without a terminator is valid. Suitable for file formats, where end-of-stream already marks the end of the last value.Whatever was read is passed to the value codec, including nothing at all, so the value codec decides whether empty is valid —
Codecs.ascii()yields an empty string, whileCodecs.ascii(int)still reports end-of-stream. -
REQUIRED
Every value must be terminated. Suitable for message formats, where the terminator is how the end of a value is known.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-