Class SMSDataCodingScheme

  • All Implemented Interfaces:
    DataObject, FastSerializable, Serializable

    public final class SMSDataCodingScheme
    extends AbstractLazyEncodedNamedInteger<SMSDataCodingScheme.EncodedValue>
    implements FastSerializable
    Class SMSDataCodingScheme encapsulates a TP-DCS field, which appears inside a SMSTPDU, hence it represents part of a larger octet string.

    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
    76543210
    Octet 0Coding group discriminates...
    cases 0,100 or 1Compressed?Has message class?Character setMessage class
    case 210Reserved
    case 3Message waiting indication group discriminates...
    cases 0,1,21100 or 01 or 10Indication active?0Indication type
    case 311110Message codingMessage class

    Field names ending in ? are booleans: 1 for true, 0 for false.

    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.

    See Also:
    Serialized Form
    • Constructor Detail

      • SMSDataCodingScheme

        public SMSDataCodingScheme()
        Constructs a new SMSDataCodingScheme object with no fields set.
      • SMSDataCodingScheme

        public SMSDataCodingScheme​(byte[] data)
        Constructs a new SMSDataCodingScheme object from network-encoded data. The data is not decoded and might not be decodable.
        Parameters:
        data - network-encoded data
        Throws:
        NullPointerException - if data is null
      • SMSDataCodingScheme

        public SMSDataCodingScheme​(byte[] data,
                                   int start,
                                   int len)
        Constructs a new SMSDataCodingScheme object from part of network-encoded data. The part starts at index start and is len bytes long. The data is not decoded and might not be decodable.
        Parameters:
        data - network-encoded data
        start - starting offset of network-encoded data in byte array
        len - default length if not predictable
        Throws:
        NullPointerException - if data is null
        IllegalArgumentException - if len is negative
      • SMSDataCodingScheme

        public SMSDataCodingScheme​(DataInput in)
                            throws IOException
        Constructs a new SMSDataCodingScheme object from data deserialized from a stream that was written by toStream(DataOutput).
        Parameters:
        in - the stream to read from
        Throws:
        EOFException - if reading is pre-empted by end-of-file
        IOException - if the data cannot be read
    • Method Detail

      • isGeneralDataChosen

        public boolean isGeneralDataChosen()
                                    throws DecodeException
        Tests whether the choice is generalData.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • isAutoDeleteChosen

        public boolean isAutoDeleteChosen()
                                   throws DecodeException
        Tests whether the choice is autoDelete.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • isMessageWaitingDiscardChosen

        public boolean isMessageWaitingDiscardChosen()
                                              throws DecodeException
        Tests whether the choice is messageWaitingDiscard.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • isMessageWaitingStoreGSM7Chosen

        public boolean isMessageWaitingStoreGSM7Chosen()
                                                throws DecodeException
        Tests whether the choice is messageWaitingStoreGSM7.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • isMessageWaitingStoreUCS2Chosen

        public boolean isMessageWaitingStoreUCS2Chosen()
                                                throws DecodeException
        Tests whether the choice is messageWaitingStoreUCS2.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • isMessageCodingChosen

        public boolean isMessageCodingChosen()
                                      throws DecodeException
        Tests whether the choice is messageCoding.
        Returns:
        true if chosen, false if not
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getGeneralData

        public SMSDataCodingScheme.GeneralScheme getGeneralData()
                                                         throws DecodeException
        Gets the value of the general data alternative.
        Returns:
        GeneralScheme representation of the general data alternative, if choice is the general data alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getAutoDelete

        public SMSDataCodingScheme.GeneralScheme getAutoDelete()
                                                        throws DecodeException
        Gets the value of the auto delete alternative.
        Returns:
        GeneralScheme representation of the auto delete alternative, if choice is the auto delete alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getMessageWaitingDiscard

        public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingDiscard()
                                                                          throws DecodeException
        Gets the value of the message waiting discard alternative.
        Returns:
        MessageWaitingScheme representation of the message waiting discard alternative, if choice is the message waiting discard alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getMessageWaitingStoreGSM7

        public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreGSM7()
                                                                            throws DecodeException
        Gets the value of the message waiting store GSM7 alternative.
        Returns:
        MessageWaitingScheme representation of the message waiting store GSM7 alternative, if choice is the message waiting store GSM7 alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getMessageWaitingStoreUCS2

        public SMSDataCodingScheme.MessageWaitingScheme getMessageWaitingStoreUCS2()
                                                                            throws DecodeException
        Gets the value of the message waiting store UCS2 alternative.
        Returns:
        MessageWaitingScheme representation of the message waiting store UCS2 alternative, if choice is the message waiting store UCS2 alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • getMessageCoding

        public SMSDataCodingScheme.MessageCodingScheme getMessageCoding()
                                                                 throws DecodeException
        Gets the value of the message coding alternative.
        Returns:
        MessageCodingScheme representation of the message coding alternative, if choice is the message coding alternative, else null
        Throws:
        DecodeException - if encoded state cannot be decoded
      • copyOf

        public 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.
        Parameters:
        from - the object from which to copy
        Returns:
        SMSDataCodingScheme
      • getFieldAccessors

        public static FieldAccessor[] getFieldAccessors()
        Gets a new array of the accessors for fields of this type.
        Returns:
        FieldAccessor[]
      • getFieldsMap

        public Map<String,​Object> getFieldsMap​(boolean withAbsents)
        Gets a Map from :discriminant-name to field-value. If choice is not set, returns a Map from : to AbstractFieldsObject.FIELD_UNINITIALISED. For a field of primitive type, the field-value is boxed. For a field of String type, the encoded form is used if the String cannot be decoded. For a type that represents an OCTET STRING that cannot be decoded, a map from "encodedValue:" to the byte array value is returned.
        Specified by:
        getFieldsMap in class AbstractFieldsObject
        Parameters:
        withAbsents - the value of this parameter is ignored
        Returns:
        Map from :discriminant-name to field-value
      • encodedIsInvalid

        protected boolean encodedIsInvalid()
        Determines whether the encoded form is invalid.
        Returns:
        boolean
      • getByteArrayForm

        public byte[] getByteArrayForm()
                                throws EncodeException
        Gets the byte array encoded form. The size of the array is the least of 1, 2, 4, or 8 according to the type's bounds. The most significant byte of the numeric value is in the lowest indexed byte of the array.
        Returns:
        byte array form
        Throws:
        EncodeException - if encoding fails
      • isGSM7Bit

        public boolean isGSM7Bit()
        Determines whether GSM 7-bit encoding is specified. This is the case if the coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is GSM_7BIT, or coding group is RESERVED, or coding group is MESSAGE_WAITING and (message waiting is DISCARD or STORE_GSM7, or is DATA and message coding is GSM_7BIT).
        Returns:
        whether GSM 7-bit encoding is specified
      • isUCS2

        public boolean isUCS2()
        Determines whether UCS-2 encoding is specified. This is the case if coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is UCS2, or coding group is MESSAGE_WAITING and message waiting is STORE_UCS2.
        Returns:
        whether UCS-2 encoding is specified
      • isData8Bit

        public boolean isData8Bit()
        Determines whether 8-bit data encoding is specified. This is the case if coding group is GENERAL_DATA or AUTO_DELETE and not compressed and character set is DATA_8BIT, or coding group is MESSAGE_WAITING and message waiting is DATA and message coding is DATA_8BIT.
        Returns:
        whether 8-bit data encoding is specified