public abstract class GeneratedCodec
extends java.lang.Object
InstructionCodec.
A GeneratedCodec sub class represents a dictionary.
A GeneratedCodec instance is tied to a specific BlinkCodec instance which holds the encode buffers
and any max binary size settings.| Modifier and Type | Field and Description |
|---|---|
protected BlinkCodec |
codec
Reference to the blink codec.
|
| Constructor and Description |
|---|
GeneratedCodec(BlinkCodec codec)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.IllegalArgumentException |
missingRequiredValue(java.lang.String valueName)
Create an encode exception when a required value is missing.
|
java.lang.Object |
readDynamicGroup(com.cinnober.msgcodec.util.LimitInputStream in)
Read a dynamic group.
|
java.lang.Object |
readDynamicGroupNull(com.cinnober.msgcodec.util.LimitInputStream in)
Read a nullable dynamic group.
|
protected abstract java.lang.Object |
readStaticGroup(int groupId,
com.cinnober.msgcodec.util.LimitInputStream in)
Read a static group.
|
protected static com.cinnober.msgcodec.DecodeException |
unknownEnumSymbol(java.lang.String valueName,
int symbolId)
Create a decode exception when an unknown enum symbol id is read.
|
protected static com.cinnober.msgcodec.DecodeException |
unknownGroupId(int groupId)
Create a decode exception when an unknown group id is read.
|
protected static java.lang.IllegalArgumentException |
unknownGroupType(java.lang.Object groupType)
Create an encode exception when trying to encode a group for an unknown group type.
|
protected static com.cinnober.msgcodec.DecodeException |
unmappableEnumSymbolId(java.lang.String valueName,
int symbolId,
java.lang.Class<? extends java.lang.Enum> enumClass)
Create a decode exception when an unmappable enum symbol id is read.
|
protected static <E extends java.lang.Enum<E>> |
unmappableEnumSymbolValue(java.lang.String valueName,
E enumValue)
Create an encode exception when an unmappable enum value is found.
|
void |
writeDynamicGroup(java.io.OutputStream out,
java.lang.Object group)
Write a dynamic group to the specified output stream.
|
void |
writeDynamicGroupNull(java.io.OutputStream out,
java.lang.Object group)
Write a nullable dynamic group to the specified output stream.
|
protected abstract void |
writeStaticGroupWithId(java.io.OutputStream out,
java.lang.Object group)
Write a static group and its group id.
|
protected final BlinkCodec codec
public GeneratedCodec(BlinkCodec codec)
(BlinkCodec, ProtocolDictionary).codec - the blink codec, not null.protected abstract void writeStaticGroupWithId(java.io.OutputStream out,
java.lang.Object group)
throws java.io.IOException,
java.lang.IllegalArgumentException
out - where to write to, not nullgroup - the group to write, not null.java.io.IOException - if the underlying stream throws an exception.java.lang.IllegalArgumentException - if an illegal value is encountered, e.g. missing required field value.protected abstract java.lang.Object readStaticGroup(int groupId,
com.cinnober.msgcodec.util.LimitInputStream in)
throws java.io.IOException,
com.cinnober.msgcodec.DecodeException
groupId - the group idin - where to read from, not null.java.io.IOException - if the underlying stream throws an exception.com.cinnober.msgcodec.DecodeException - if the group could not be decoded.public void writeDynamicGroup(java.io.OutputStream out,
java.lang.Object group)
throws java.io.IOException,
java.lang.IllegalArgumentException
out - where to write to, not null.group - the group to encode, not nulljava.io.IOException - if the underlying stream throws an exception.java.lang.IllegalArgumentExceptionpublic void writeDynamicGroupNull(java.io.OutputStream out,
java.lang.Object group)
throws java.io.IOException
out - where to write to, or null.group - the group to encode, not nulljava.io.IOException - if the underlying stream throws an exception.public java.lang.Object readDynamicGroup(com.cinnober.msgcodec.util.LimitInputStream in)
throws java.io.IOException
in - the stream to read from.java.io.IOException - if the underlying stream throws an exception.public java.lang.Object readDynamicGroupNull(com.cinnober.msgcodec.util.LimitInputStream in)
throws java.io.IOException
in - the stream to read from.java.io.IOException - if the underlying stream throws an exception.protected static java.lang.IllegalArgumentException missingRequiredValue(java.lang.String valueName)
valueName - the name of the value, e.g. a field name, not null.protected static com.cinnober.msgcodec.DecodeException unmappableEnumSymbolId(java.lang.String valueName,
int symbolId,
java.lang.Class<? extends java.lang.Enum> enumClass)
valueName - the name of the value, e.g. a field name, not null.symbolId - the symbol idenumClass - the enum class, not nullprotected static com.cinnober.msgcodec.DecodeException unknownEnumSymbol(java.lang.String valueName,
int symbolId)
valueName - the name of the value, e.g. a field name, not null.symbolId - the symbol idprotected static <E extends java.lang.Enum<E>> java.lang.IllegalArgumentException unmappableEnumSymbolValue(java.lang.String valueName,
E enumValue)
E - the enum typevalueName - the name of the value, e.g. a field name, not null.enumValue - the unmappable unum value, not nullprotected static java.lang.IllegalArgumentException unknownGroupType(java.lang.Object groupType)
groupType - the group type (e.g. a java class) of the group to be encoded, not null.protected static com.cinnober.msgcodec.DecodeException unknownGroupId(int groupId)
groupId - the group id.