public final class SMSDataCodingScheme extends AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue> implements FastSerializable
The API offered by this class is as if the type were specified in ASN.1 as follows.
SMSDataCodingScheme ::= CHOICE { generalData GeneralScheme, autoDelete GeneralScheme, messageWaitingDiscard MessageWaitingScheme, messageWaitingStoreGSM7 MessageWaitingScheme, messageWaitingStoreUCS2 MessageWaitingScheme, messageCoding MessageCodingScheme }The three subtypes referenced in this CHOICE type are implemented by nested classes; those represent the three alternative layouts of the octet in the data encoding tabulated below. The labels for those layouts in the table are "cases 0,1", "cases 0,1,2" and "case 3"; these numbers correspond to the six alternatives in the CHOICE.
Data Encoding - based on 3GPP TS 23.038 V8.2.0 (2008-09) §4 pp8-10 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |||
Octet 0 | Coding group discriminates... | |||||||||
cases 0,1 | 0 | 0 or 1 | Compressed? | Has message class? | Character set | Message class | ||||
case 2 | 1 | 0 | Reserved | |||||||
case 3 | Message waiting indication group discriminates... | |||||||||
cases 0,1,2 | 1 | 1 | 00 or 01 or 10 | Indication active? | 0 | Indication type | ||||
case 3 | 1 | 1 | 1 | 1 | 0 | Message coding | Message class |
We regard the Coding Group as a discriminant for how the following six bits are interpreted. We regard the Message Waiting Indication Group as a discriminant for how the following four bits are interpreted. This nomenclature differs from the standard 23.038, where the Coding Group refers to bits 7-4, and the Message Waiting Indication Group distinguishes particular cases of the Coding Group.
Modifier and Type | Class and Description |
---|---|
static class |
SMSDataCodingScheme.Choice
Enumeration of discriminating values.
|
static class |
SMSDataCodingScheme.EncodedValue
Representation of SMSDataCodingScheme values as NamedIntegers.
|
static class |
SMSDataCodingScheme.GeneralScheme
Class GeneralScheme represents the General Data and Auto Delete cases of a TP-DCS field.
|
static class |
SMSDataCodingScheme.MessageClass
Enumeration of Message Class constants.
|
static class |
SMSDataCodingScheme.MessageCodingScheme
Class MessageCodingScheme represents the Message Coding case of a TP_DCS field.
|
static class |
SMSDataCodingScheme.MessageWaitingScheme
Class MessageWaitingScheme represents the Message Waiting cases of a TP_DCS field.
|
isDecoded
encoded
FIELD_ABSENT, FIELD_UNINITIALISED
Constructor and Description |
---|
SMSDataCodingScheme()
Constructs a new SMSDataCodingScheme object with no fields set.
|
SMSDataCodingScheme(byte[] data)
Constructs a new SMSDataCodingScheme object from network-encoded data.
|
SMSDataCodingScheme(byte[] data,
int start,
int len)
Constructs a new SMSDataCodingScheme object from part of network-encoded data.
|
SMSDataCodingScheme(DataInput in)
Constructs a new SMSDataCodingScheme object from data deserialized from a stream that was written by
toStream(DataOutput) . |
Modifier and Type | Method and Description |
---|---|
void |
checkFieldsSet()
Checks that all mandatory fields are present.
|
SMSDataCodingScheme |
clone()
Constructs a copy of this object and everything reachable from it.
|
static SMSDataCodingScheme |
copyOf(SMSDataCodingScheme 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 SMSDataCodingScheme.EncodedValue |
fromValue(int value)
Converts an int to a NamedInteger.
|
SMSDataCodingScheme.GeneralScheme |
getAutoDelete()
Gets the value of the auto delete alternative.
|
byte[] |
getByteArrayForm()
Gets the byte array encoded form.
|
SMSDataCodingScheme.Choice |
getChoice()
Gets the discriminant for which choice is chosen.
|
SMSDataCodingScheme.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.
|
SMSDataCodingScheme.GeneralScheme |
getGeneralData()
Gets the value of the general data alternative.
|
SMSDataCodingScheme.MessageCodingScheme |
getMessageCoding()
Gets the value of the message coding alternative.
|
SMSDataCodingScheme.MessageWaitingScheme |
getMessageWaitingDiscard()
Gets the value of the message waiting discard alternative.
|
SMSDataCodingScheme.MessageWaitingScheme |
getMessageWaitingStoreGSM7()
Gets the value of the message waiting store GSM7 alternative.
|
SMSDataCodingScheme.MessageWaitingScheme |
getMessageWaitingStoreUCS2()
Gets the value of the message waiting store UCS2 alternative.
|
boolean |
isAutoDeleteChosen()
Tests whether the choice is autoDelete.
|
boolean |
isData8Bit()
Determines whether 8-bit data encoding is specified.
|
boolean |
isGeneralDataChosen()
Tests whether the choice is generalData.
|
boolean |
isGSM7Bit()
Determines whether GSM 7-bit encoding is specified.
|
boolean |
isMessageCodingChosen()
Tests whether the choice is messageCoding.
|
boolean |
isMessageWaitingDiscardChosen()
Tests whether the choice is messageWaitingDiscard.
|
boolean |
isMessageWaitingStoreGSM7Chosen()
Tests whether the choice is messageWaitingStoreGSM7.
|
boolean |
isMessageWaitingStoreUCS2Chosen()
Tests whether the choice is messageWaitingStoreUCS2.
|
boolean |
isUCS2()
Determines whether UCS-2 encoding is specified.
|
SMSDataCodingScheme |
setAutoDelete(SMSDataCodingScheme.GeneralScheme value)
Sets the value of the auto delete alternative.
|
SMSDataCodingScheme |
setGeneralData(SMSDataCodingScheme.GeneralScheme value)
Sets the value of the general data alternative.
|
SMSDataCodingScheme |
setMessageCoding(SMSDataCodingScheme.MessageCodingScheme value)
Sets the value of the message coding alternative.
|
SMSDataCodingScheme |
setMessageWaitingDiscard(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting discard alternative.
|
SMSDataCodingScheme |
setMessageWaitingStoreGSM7(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting store GSM7 alternative.
|
SMSDataCodingScheme |
setMessageWaitingStoreUCS2(SMSDataCodingScheme.MessageWaitingScheme value)
Sets the value of the message waiting store UCS2 alternative.
|
void |
setReadOnly()
Sets this and all its fields to be immutable.
|
void |
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading by
SMSDataCodingScheme(DataInput) . |
checkDecode, checkModifyAndDecode
equals, hashCode, toString
checkModify, isReadOnly
public SMSDataCodingScheme()
public SMSDataCodingScheme(byte[] data)
data
- network-encoded dataNullPointerException
- if data is nullpublic SMSDataCodingScheme(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 SMSDataCodingScheme(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 void toStream(DataOutput out) throws IOException
SMSDataCodingScheme(DataInput)
.toStream
in interface FastSerializable
out
- the stream to write toIOException
- if an I/O error occurspublic SMSDataCodingScheme.Choice getChoice() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isGeneralDataChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isAutoDeleteChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isMessageWaitingDiscardChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isMessageWaitingStoreGSM7Chosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isMessageWaitingStoreUCS2Chosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean isMessageCodingChosen() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic void checkFieldsSet() throws EncodeException
checkFieldsSet
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.EncodedValue>
EncodeException
- if any mandatory field is not presentpublic SMSDataCodingScheme.GeneralScheme getGeneralData() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.GeneralScheme getAutoDelete() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingDiscard() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreGSM7() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreUCS2() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.MessageCodingScheme getMessageCoding() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme setGeneralData(SMSDataCodingScheme.GeneralScheme value) throws IllegalStateException
value
- GeneralScheme representation of the general data alternativeIllegalStateException
public SMSDataCodingScheme setAutoDelete(SMSDataCodingScheme.GeneralScheme value) throws IllegalStateException
value
- GeneralScheme representation of the auto delete alternativeIllegalStateException
public SMSDataCodingScheme setMessageWaitingDiscard(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
value
- MessageWaitingScheme representation of the message waiting discard alternativeIllegalStateException
public SMSDataCodingScheme setMessageWaitingStoreGSM7(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
value
- MessageWaitingScheme representation of the message waiting store GSM7 alternativeIllegalStateException
public SMSDataCodingScheme setMessageWaitingStoreUCS2(SMSDataCodingScheme.MessageWaitingScheme value) throws IllegalStateException
value
- MessageWaitingScheme representation of the message waiting store UCS2 alternativeIllegalStateException
public SMSDataCodingScheme setMessageCoding(SMSDataCodingScheme.MessageCodingScheme value) throws IllegalStateException
value
- MessageCodingScheme representation of the message coding alternativeIllegalStateException
public static SMSDataCodingScheme copyOf(SMSDataCodingScheme from)
from
- the object from which to copypublic SMSDataCodingScheme clone()
clone
in interface DataObject
clone
in class AbstractDataObject
public void setReadOnly()
setReadOnly
in interface DataObject
setReadOnly
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 SMSDataCodingScheme.EncodedValue getEncodedForm() throws EncodeException
EncodeException
- if encoding failspublic byte[] getByteArrayForm() throws EncodeException
EncodeException
- if encoding failsprotected SMSDataCodingScheme.EncodedValue fromValue(int value)
fromValue
in class AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue>
value
- intpublic boolean isGSM7Bit()
public boolean isUCS2()
public boolean isData8Bit()
protected void encode() throws EncodeException
encode
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.EncodedValue>
EncodeException
- if address cannot be encodedprotected void decode()
decode
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.EncodedValue>