public final class SMSProtocolId extends AbstractLazyEncodedNamedInteger<SMSProtocolId.EncodedValue> implements FastSerializable
The API offered by this class is as if the type were defined in ASN.1 as follows.
SMSProtocolId ::= CHOICE { applicationLayerProtocol ApplicationLayerProtocol, telematicDevice TelematicDevice, transferLayerProtocol TransferLayerProtocol, serviceCentreProtocol ServiceCentreProtocol }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 23.040 V9.0.0 (2009-06) §9.2.3.9 pp65-67 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |||
Octet 0 | Tag discriminates... | |||||||||
case 0 | Telematic interworking? discriminates... | |||||||||
case 0 | 0 | 0 | 0 | Application layer protocol | ||||||
case 1 | 0 | 0 | 1 | Telematic device | ||||||
case 1 | 0 | 1 | Transfer layer protocol | |||||||
case 2 | 1 | 0 | Reserved | |||||||
case 3 | 1 | 1 | Service centre protocol |
The tag is a discriminant for how the following six bits are decoded. The Telematic Interworking flag is a discriminant for how the following five bits are decoded. On encoding, each discriminant is automatically set according to which alternative is encoded. A SMSProtocolId contains exactly one of Application Layer Protocol, Telematic Device, Transfer Layer Protocol or Service Centre Protocol.
Modifier and Type | Class and Description |
---|---|
static class |
SMSProtocolId.ApplicationLayerProtocol
Application Layer Protocol constants.
|
static class |
SMSProtocolId.Choice
Enumeration of discriminating values.
|
static class |
SMSProtocolId.EncodedValue
Representation of SMSProtocolId values as NamedIntegers.
|
static class |
SMSProtocolId.ServiceCentreProtocol
ServiceCentreProtocol constants.
|
static class |
SMSProtocolId.TelematicDevice
Telematic Device constants.
|
static class |
SMSProtocolId.TransferLayerProtocol
Transfer Layer Protocol constants.
|
isDecoded
encoded
FIELD_ABSENT, FIELD_UNINITIALISED
Constructor and Description |
---|
SMSProtocolId()
Constructs a new SMSProtocolId object with no fields set.
|
SMSProtocolId(byte[] data)
Constructs a new SMSProtocolId object from network-encoded data.
|
SMSProtocolId(byte[] data,
int start,
int len)
Constructs a new SMSProtocolId object from part of network-encoded data.
|
SMSProtocolId(DataInput in)
Constructs a new SMSProtocolId object from data deserialized from a stream that was written by
toStream(DataOutput) . |
SMSProtocolId(SMSProtocolId.ApplicationLayerProtocol applicationLayerProtocol)
Constructs a new SMSProtocolId object from the given ApplicationLayerProtocol.
|
SMSProtocolId(SMSProtocolId.ServiceCentreProtocol serviceCentreProtocol)
Constructs a new SMSProtocolId object from the given ServiceCentreProtocol.
|
SMSProtocolId(SMSProtocolId.TelematicDevice telematicDevice)
Constructs a new SMSProtocolId object from the given TelematicDevice.
|
SMSProtocolId(SMSProtocolId.TransferLayerProtocol transferLayerProtocol)
Constructs a new SMSProtocolId object from the given TransferLayerProtocol.
|
Modifier and Type | Method and Description |
---|---|
void |
checkFieldsSet()
Checks that all mandatory fields are present.
|
SMSProtocolId |
clone()
Constructs a copy of this object and everything reachable from it.
|
static SMSProtocolId |
copyOf(SMSProtocolId 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.
|
protected SMSProtocolId.EncodedValue |
fromValue(int value)
Converts an int to a NamedInteger.
|
SMSProtocolId.ApplicationLayerProtocol |
getApplicationLayerProtocol()
Gets the value of the application layer protocol.
|
byte[] |
getByteArrayForm()
Gets the byte array encoded form.
|
SMSProtocolId.Choice |
getChoice()
Gets the discriminant for which choice is chosen.
|
static int |
getContainedLength(byte[] data,
int start,
int len)
Determines the length of the encoded value that commences at offset
start in the given data . |
SMSProtocolId.EncodedValue |
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 :discriminant-name to field-value.
|
SMSProtocolId.ServiceCentreProtocol |
getServiceCentreProtocol()
Gets the value of the service centre protocol.
|
SMSProtocolId.TelematicDevice |
getTelematicDevice()
Gets the value of the telematic device.
|
SMSProtocolId.TransferLayerProtocol |
getTransferLayerProtocol()
Gets the value of the transfer layer protocol.
|
boolean |
isApplicationLayerProtocolChosen()
Tests whether the choice is applicationLayerProtocol.
|
boolean |
isServiceCentreProtocolChosen()
Tests whether the choice is serviceCentreProtocol.
|
boolean |
isTelematicDeviceChosen()
Tests whether the choice is telematicDevice.
|
boolean |
isTransferLayerProtocolChosen()
Tests whether the choice is transferLayerProtocol.
|
SMSProtocolId |
setApplicationLayerProtocol(SMSProtocolId.ApplicationLayerProtocol value)
Sets the value of the application layer protocol.
|
SMSProtocolId |
setServiceCentreProtocol(SMSProtocolId.ServiceCentreProtocol value)
Sets the value of the service centre protocol.
|
SMSProtocolId |
setTelematicDevice(SMSProtocolId.TelematicDevice value)
Sets the value of the telematic device.
|
SMSProtocolId |
setTransferLayerProtocol(SMSProtocolId.TransferLayerProtocol value)
Sets the value of the transfer layer protocol.
|
void |
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading by
SMSProtocolId(DataInput) . |
checkDecode, checkModifyAndDecode
equals, hashCode, toString
checkModify, isReadOnly, setReadOnly
public SMSProtocolId()
public SMSProtocolId(byte[] data)
data
- network-encoded dataNullPointerException
- if data is nullpublic SMSProtocolId(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 SMSProtocolId(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 SMSProtocolId(SMSProtocolId.ApplicationLayerProtocol applicationLayerProtocol)
applicationLayerProtocol
- ApplicationLayerProtocolIllegalArgumentException
- if any argument is not within its specified boundspublic SMSProtocolId(SMSProtocolId.TelematicDevice telematicDevice)
telematicDevice
- TelematicDeviceIllegalArgumentException
- if any argument is not within its specified boundspublic SMSProtocolId(SMSProtocolId.TransferLayerProtocol transferLayerProtocol)
transferLayerProtocol
- TransferLayerProtocolIllegalArgumentException
- if any argument is not within its specified boundspublic SMSProtocolId(SMSProtocolId.ServiceCentreProtocol serviceCentreProtocol)
serviceCentreProtocol
- ServiceCentreProtocolIllegalArgumentException
- if any argument is not within its specified boundspublic void toStream(DataOutput out) throws IOException
SMSProtocolId(DataInput)
.toStream
in interface FastSerializable
out
- the stream to write toIOException
- if an I/O error occurspublic SMSProtocolId.Choice getChoice() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isApplicationLayerProtocolChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isTelematicDeviceChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isTransferLayerProtocolChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isServiceCentreProtocolChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic void checkFieldsSet() throws EncodeException
checkFieldsSet
in class AbstractLazyEncodedDataObject<SMSProtocolId.EncodedValue>
EncodeException
- if any mandatory field is not presentpublic SMSProtocolId.ApplicationLayerProtocol getApplicationLayerProtocol() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSProtocolId.TelematicDevice getTelematicDevice() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSProtocolId.TransferLayerProtocol getTransferLayerProtocol() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSProtocolId.ServiceCentreProtocol getServiceCentreProtocol() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSProtocolId setApplicationLayerProtocol(SMSProtocolId.ApplicationLayerProtocol value) throws IllegalStateException
value
- ApplicationLayerProtocol representation of the application layer protocolIllegalStateException
public SMSProtocolId setTelematicDevice(SMSProtocolId.TelematicDevice value) throws IllegalStateException
value
- TelematicDevice representation of the telematic deviceIllegalStateException
public SMSProtocolId setTransferLayerProtocol(SMSProtocolId.TransferLayerProtocol value) throws IllegalStateException
value
- TransferLayerProtocol representation of the transfer layer protocolIllegalStateException
public SMSProtocolId setServiceCentreProtocol(SMSProtocolId.ServiceCentreProtocol value) throws IllegalStateException
value
- ServiceCentreProtocol representation of the service centre protocolIllegalStateException
public static SMSProtocolId copyOf(SMSProtocolId from)
from
- the object from which to copypublic SMSProtocolId 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
- the value of this parameter is ignoredprotected boolean encodedIsInvalid()
public SMSProtocolId.EncodedValue getEncodedForm() throws EncodeException
EncodeException
- if encoding failspublic byte[] getByteArrayForm() throws EncodeException
EncodeException
- if encoding failspublic static int getContainedLength(byte[] data, int start, int len)
start
in the given data
.
The value is not fully decoded and might not be decodable.
If the encoded value ends with a filling field,
then the given len
is returned.
If the encoded value is so currupt that its length cannot be determined,
then 0
is returned.data
- network-encoded datastart
- index into data where value commenceslen
- length in data to be consideredNullPointerException
- if data is nullprotected SMSProtocolId.EncodedValue fromValue(int value)
fromValue
in class AbstractLazyEncodedNamedInteger<SMSProtocolId.EncodedValue>
value
- intprotected void encode() throws EncodeException
encode
in class AbstractLazyEncodedDataObject<SMSProtocolId.EncodedValue>
EncodeException
- if more than one of the four options has been setprotected void decode() throws DecodeException
decode
in class AbstractLazyEncodedDataObject<SMSProtocolId.EncodedValue>
DecodeException
- if reserved value is found