public final class RPCause extends AbstractLazyEncodedByteArray implements FastSerializable
The API offered by this class is as if the type were specified in ASN.1 as follows.
RPCause ::= SEQUENCE { causeValue CauseValue, diagnostic INTEGER (0..255) OPTIONAL }The class takes care of encoding the field values into a byte-array and decoding field values from a byte-array, the encoded representation being as tabulated below.
Data Encoding - based on 3GPP TS 24.011 V8.2.0 (2009-06) §8.2.5.4 pp39-41 | ||||||||
---|---|---|---|---|---|---|---|---|
8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | |
1 octet | Ext? | Cause value | ||||||
1 octet* | Diagnostic if any |
Modifier and Type | Class and Description |
---|---|
static class |
RPCause.CauseValue
Cause value constants.
|
isDecoded
encoded
FIELD_ABSENT, FIELD_UNINITIALISED
Constructor and Description |
---|
RPCause()
Constructs a new RPCause object with no fields set.
|
RPCause(byte[] data)
Constructs a new RPCause object from network-encoded data.
|
RPCause(byte[] data,
int start,
int len)
Constructs a new RPCause object from part of network-encoded data.
|
RPCause(DataInput in)
Constructs a new RPCause object from data deserialized from a stream that was written by
toStream(DataOutput) . |
RPCause(RPCause.CauseValue causeValue)
Constructs a new RPCause object from the given argument,
with no diagnostic.
|
RPCause(RPCause.CauseValue causeValue,
int diagnostic)
Constructs a new RPCause object from the given arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
checkFieldsSet()
Checks that all mandatory fields are present.
|
RPCause |
clone()
Constructs a copy of this object and everything reachable from it.
|
static RPCause |
copyOf(RPCause from)
Creates a new object of this type, cloning the values of common fields from the given object of any subclass of the same base type.
|
protected void |
decode()
Computes the decoded form from the encoded form.
|
protected void |
encode()
Computes the encoded form from the decoded form.
|
protected boolean |
encodedIsInvalid()
Determines whether the encoded form is invalid.
|
RPCause.CauseValue |
getCauseValue()
Gets the value of the cause value.
|
int |
getDiagnostic()
Gets the value of any diagnostic.
|
byte[] |
getEncodedForm()
Gets the encoded form.
|
static FieldAccessor[] |
getFieldAccessors()
Gets a new array of the accessors for fields of this type.
|
Map<String,Object> |
getFieldsMap(boolean withAbsents)
Gets a Map from field-name to field-value for the fields of a sequence.
|
boolean |
hasCauseValue()
Tests whether the field CauseValue has a value.
|
boolean |
hasDiagnostic()
Tests whether the field Diagnostic has a value.
|
RPCause |
setCauseValue(RPCause.CauseValue value)
Sets the value of the cause value.
|
RPCause |
setDiagnostic(int value)
Sets the value of any diagnostic.
|
RPCause |
setDiagnosticPresent(boolean flag)
Sets the presence or absence of the field Diagnostic.
|
void |
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading by
RPCause(DataInput) . |
checkDecode, checkModifyAndDecode
equals, hashCode, toString
checkModify, isReadOnly, setReadOnly
public RPCause()
public RPCause(byte[] data)
data
- network-encoded dataNullPointerException
- if data is nullpublic RPCause(byte[] data, int start, int len)
start
and is len
bytes long.
The data is not decoded and might not be decodable.data
- network-encoded datastart
- starting offset of network-encoded data in byte arraylen
- default length if not predictableNullPointerException
- if data is nullIllegalArgumentException
- if len is negativepublic RPCause(DataInput in) throws IOException
toStream(DataOutput)
.in
- the stream to read fromEOFException
- if reading is pre-empted by end-of-fileIOException
- if the data cannot be readpublic RPCause(RPCause.CauseValue causeValue)
causeValue
- the causepublic RPCause(RPCause.CauseValue causeValue, int diagnostic)
causeValue
- the causediagnostic
- the diagnostic associated with the cause.
Not all causes permit and not all protocols support diagnostic information,
in which case don't use this constructor.public void toStream(DataOutput out) throws IOException
RPCause(DataInput)
.toStream
in interface FastSerializable
out
- the stream to write toIOException
- if an I/O error occurspublic boolean hasCauseValue() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean hasDiagnostic() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic RPCause setDiagnosticPresent(boolean flag) throws IllegalStateException
flag
- whether the field should be marked as presentIllegalStateException
- if this instance has been marked as read-onlypublic void checkFieldsSet() throws EncodeException
checkFieldsSet
in class AbstractLazyEncodedDataObject<byte[]>
EncodeException
- if any mandatory field is not presentpublic RPCause.CauseValue getCauseValue() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic int getDiagnostic() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic RPCause setCauseValue(RPCause.CauseValue value) throws IllegalStateException
value
- CauseValue representation of the cause valueIllegalStateException
public RPCause setDiagnostic(int value) throws IllegalStateException
value
- int representation of any diagnosticIllegalStateException
public static RPCause copyOf(RPCause from)
from
- the object from which to copypublic RPCause clone()
clone
in interface DataObject
clone
in class AbstractDataObject
public static FieldAccessor[] getFieldAccessors()
public Map<String,Object> getFieldsMap(boolean withAbsents)
getFieldsMap
in class AbstractFieldsObject
withAbsents
- whether to put absent optional fields into Mapprotected boolean encodedIsInvalid()
public byte[] getEncodedForm() throws EncodeException
EncodeException
- if encoding failsprotected void encode() throws EncodeException
encode
in class AbstractLazyEncodedDataObject<byte[]>
EncodeException
- if encoding failsprotected void decode()
decode
in class AbstractLazyEncodedDataObject<byte[]>