public abstract class ByteDecoder extends Object
Constructor and Description |
---|
ByteDecoder() |
Modifier and Type | Method and Description |
---|---|
abstract Object |
createEmptyComposite(String sbeCompositeTypeName,
Object ref)
Creates or fills empty instance of the class that represents standard composite type.
|
abstract <T> T |
createEmptyCustomComposite(Class<T> cls)
Creates empty instance of the class that implements given custom composite interface.
|
abstract IMessage |
decode(byte[] data,
int offset,
int size)
This function does the following:
1.
|
abstract IMessage |
decodePreCreatedMessage(byte[] data,
int offset,
int size)
This function does the following:
1.
|
abstract IMessage |
encode(byte[] data,
int offset,
int size,
int templateId)
This function does the following:
1.
|
abstract IMessage |
encodePreCreatedMessage(byte[] data,
int offset,
int size,
int templateId)
This function does the following:
1.
|
abstract boolean |
isNullComposite(String sbeCompositeTypeName,
Object ref)
Checks the object of the standard composite type if it is null.
|
public abstract IMessage decode(byte[] data, int offset, int size)
if header size field > size then returns null: can't read the message
2. Uses generated code my messageHeader to read messageHeader
3. Creates message template
4. Points this template to data buffer
5. Returns message templatedata
- - byte buffer with dataoffset
- - start offset of the message.size
- available data in buffer to decode.public abstract IMessage decodePreCreatedMessage(byte[] data, int offset, int size)
if header size field > size then returns null: can't read the message
2. Uses generated code my messageHeader to read messageHeader
3. Selects right message template (templates are already created)
4. Points this template to data buffer
5. Returns message template
WARNING: in next call of this method, returned message object can be reused.
If you need to use returned message in another thread, please clone it or use decode method.data
- - byte buffer with dataoffset
- - start offset of the message.size
- available data in buffer to decode.public abstract IMessage encode(byte[] data, int offset, int size, int templateId)
data
- - byte buffer with dataoffset
- - start offset of the message.size
- available data in buffer to decode.templateId
- message template id.public abstract IMessage encodePreCreatedMessage(byte[] data, int offset, int size, int templateId)
data
- - byte buffer with dataoffset
- - start offset of the message.size
- available data in buffer to decode.templateId
- message template id.public abstract <T> T createEmptyCustomComposite(Class<T> cls)
ByteDecoderFactory.create(MessageSchema, Class[])
method
when the decoder was created.T
- Class of the custom composite.cls
- Class of the custom composite.public abstract Object createEmptyComposite(String sbeCompositeTypeName, Object ref)
sbeCompositeTypeName
- Name of the type as it mentioned in the SBE template.ref
- Object of suitable standard composite type to fill with null value, or null/public abstract boolean isNullComposite(String sbeCompositeTypeName, Object ref)
sbeCompositeTypeName
- SBE type name that is used to check content of the object.ref
- Object to check.Copyright © 2005–2024 Onix Solutions. All rights reserved.