public static final class SMSDataCodingScheme.GeneralScheme extends AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.GeneralScheme.EncodedValue>
The API offered by this class is as if the type were specified in ASN.1 as follows.
GeneralScheme ::= SEQUENCE { compressed BOOLEAN, characterSet CharacterSet, messageClass MessageClass OPTIONAL }The class takes care of encoding the field values into a NamedInteger and decoding field values from a NamedInteger, the encoded representation being as tabulated below.
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 | 0 | 0 | Compressed? | Has message class? | Character set | Message class |
Modifier and Type | Class and Description |
---|---|
static class |
SMSDataCodingScheme.GeneralScheme.CharacterSet
Enumeration of Character Set constants.
|
static class |
SMSDataCodingScheme.GeneralScheme.EncodedValue
Representation of GeneralScheme values as NamedIntegers.
|
isDecoded
encoded
FIELD_ABSENT, FIELD_UNINITIALISED
Constructor and Description |
---|
SMSDataCodingScheme.GeneralScheme()
Constructs a new GeneralScheme object with no fields set.
|
SMSDataCodingScheme.GeneralScheme(byte[] data)
Constructs a new GeneralScheme object from network-encoded data.
|
SMSDataCodingScheme.GeneralScheme(byte[] data,
int start,
int len)
Constructs a new GeneralScheme object from part of network-encoded data.
|
SMSDataCodingScheme.GeneralScheme(DataInput in)
Constructs a new GeneralScheme 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.GeneralScheme |
clone()
Constructs a copy of this object and everything reachable from it.
|
static SMSDataCodingScheme.GeneralScheme |
copyOf(SMSDataCodingScheme.GeneralScheme 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.GeneralScheme.EncodedValue |
fromValue(int value)
Converts an int to a NamedInteger.
|
byte[] |
getByteArrayForm()
Gets the byte array encoded form.
|
SMSDataCodingScheme.GeneralScheme.CharacterSet |
getCharacterSet()
Gets the value of the character set.
|
boolean |
getCompressed()
Gets the value of whether the text is compressed.
|
SMSDataCodingScheme.GeneralScheme.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 field-name to field-value for the fields of a sequence.
|
SMSDataCodingScheme.MessageClass |
getMessageClass()
Gets the value of the message class.
|
boolean |
hasCharacterSet()
Tests whether the field CharacterSet has a value.
|
boolean |
hasCompressed()
Tests whether the field Compressed has a value.
|
boolean |
hasMessageClass()
Tests whether the field MessageClass has a value.
|
SMSDataCodingScheme.GeneralScheme |
setCharacterSet(SMSDataCodingScheme.GeneralScheme.CharacterSet value)
Sets the value of the character set.
|
SMSDataCodingScheme.GeneralScheme |
setCompressed(boolean value)
Sets the value of whether the text is compressed.
|
SMSDataCodingScheme.GeneralScheme |
setCompressedPresent(boolean flag)
Sets the presence or absence of the field Compressed.
|
SMSDataCodingScheme.GeneralScheme |
setMessageClass(SMSDataCodingScheme.MessageClass value)
Sets the value of the message class.
|
void |
toStream(DataOutput out)
Serializes this object to a stream in a form suitable for reading by
SMSDataCodingScheme.GeneralScheme(DataInput) . |
checkDecode, checkModifyAndDecode
equals, hashCode, toString
checkModify, isReadOnly, setReadOnly
public SMSDataCodingScheme.GeneralScheme()
public SMSDataCodingScheme.GeneralScheme(byte[] data)
data
- network-encoded dataNullPointerException
- if data is nullpublic SMSDataCodingScheme.GeneralScheme(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.GeneralScheme(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.GeneralScheme(DataInput)
.out
- the stream to write toIOException
- if an I/O error occurspublic boolean hasCompressed() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.GeneralScheme setCompressedPresent(boolean flag) throws IllegalStateException
flag
- whether the field should be marked as presentIllegalStateException
- if this instance has been marked as read-onlypublic boolean hasCharacterSet() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic boolean hasMessageClass() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic void checkFieldsSet() throws EncodeException
checkFieldsSet
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.GeneralScheme.EncodedValue>
EncodeException
- if any mandatory field is not presentpublic boolean getCompressed() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.GeneralScheme.CharacterSet getCharacterSet() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.MessageClass getMessageClass() throws DecodeException
DecodeException
- if encoded state cannot be decodedpublic SMSDataCodingScheme.GeneralScheme setCompressed(boolean value) throws IllegalStateException
value
- boolean representation of whether the text is compressedIllegalStateException
public SMSDataCodingScheme.GeneralScheme setCharacterSet(SMSDataCodingScheme.GeneralScheme.CharacterSet value) throws IllegalStateException
value
- CharacterSet representation of the character setIllegalStateException
public SMSDataCodingScheme.GeneralScheme setMessageClass(SMSDataCodingScheme.MessageClass value) throws IllegalStateException
value
- MessageClass representation of the message classIllegalStateException
public static SMSDataCodingScheme.GeneralScheme copyOf(SMSDataCodingScheme.GeneralScheme from)
from
- the object from which to copypublic SMSDataCodingScheme.GeneralScheme 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 SMSDataCodingScheme.GeneralScheme.EncodedValue getEncodedForm() throws EncodeException
EncodeException
- if encoding failspublic byte[] getByteArrayForm() throws EncodeException
EncodeException
- if encoding failsprotected SMSDataCodingScheme.GeneralScheme.EncodedValue fromValue(int value)
fromValue
in class AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.GeneralScheme.EncodedValue>
value
- intprotected void encode()
encode
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.GeneralScheme.EncodedValue>
EncodeException
- if address cannot be encodedprotected void decode()
decode
in class AbstractLazyEncodedDataObject<SMSDataCodingScheme.GeneralScheme.EncodedValue>