public abstract class AbstractLazyEncodedDataObject<T> extends AbstractEncodedDataObject<T>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isDecoded
Whether the state is in the decoded form.
|
encodedFIELD_ABSENT, FIELD_UNINITIALISED| Modifier | Constructor and Description |
|---|---|
protected |
AbstractLazyEncodedDataObject()
Constructs a new AbstractLazyEncodedDataObject.
|
protected |
AbstractLazyEncodedDataObject(byte[] data,
int start,
int len)
Constructs a new AbstractLazyEncodedDataObject from part of given network-encoded data.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkDecode()
Ensures that the state is in the decoded form.
|
protected abstract void |
checkFieldsSet()
Checks that all mandatory fields are present.
|
protected void |
checkModifyAndDecode()
For use before setting a field of the decoded representation:
checks that the object has not been marked read-only,
and ensures that the state is in the decoded form.
|
protected abstract void |
decode()
Computes the decoded form of the state from the encoded form.
|
protected abstract void |
encode()
Computes the encoded form of the state from the decoded form.
|
equals, getFieldsMap, hashCode, toStringcheckModify, clone, isReadOnly, setReadOnlyprotected volatile boolean isDecoded
protected AbstractLazyEncodedDataObject()
protected AbstractLazyEncodedDataObject(byte[] data,
int start,
int len)
start and is len bytes long.
The state is in the encoded form:
it is not decoded and might not be decodable.data - network-encoded datastart - starting offset of network-encoded datalen - length of encoded data in bytesNullPointerException - if data is nullIllegalArgumentException - if len is negativeArrayIndexOutOfBoundsException - if the part is not within the dataprotected abstract void checkFieldsSet()
throws EncodeException
EncodeException - if any mandatory field is not presentprotected abstract void encode()
throws EncodeException
EncodeException - if encoding failsprotected abstract void decode()
throws DecodeException
isDecoded to true.DecodeException - if decoding failsprotected void checkDecode()
throws DecodeException
DecodeException - if decoding failsprotected void checkModifyAndDecode()
throws IllegalStateException,
DecodeException
IllegalStateException - if the object is readonlyDecodeException - if decoding fails