FileDocCategorySizeDatePackage
UserData.javaAPI DocAndroid 5.1 API6311Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.cdma.sms

UserData

public class UserData extends Object

Fields Summary
public static final int
ENCODING_OCTET
User data encoding types. (See 3GPP2 C.R1001-F, v1.0, table 9.1-1)
public static final int
ENCODING_IS91_EXTENDED_PROTOCOL
public static final int
ENCODING_7BIT_ASCII
public static final int
ENCODING_IA5
public static final int
ENCODING_UNICODE_16
public static final int
ENCODING_SHIFT_JIS
public static final int
ENCODING_KOREAN
public static final int
ENCODING_LATIN_HEBREW
public static final int
ENCODING_LATIN
public static final int
ENCODING_GSM_7BIT_ALPHABET
public static final int
ENCODING_GSM_DCS
public static final int
IS91_MSG_TYPE_VOICEMAIL_STATUS
IS-91 message types. (See TIA/EIS/IS-91-A-ENGL 1999, table 3.7.1.1-3)
public static final int
IS91_MSG_TYPE_SHORT_MESSAGE_FULL
public static final int
IS91_MSG_TYPE_CLI
public static final int
IS91_MSG_TYPE_SHORT_MESSAGE
public static final char[]
ASCII_MAP
US ASCII character mapping table. This table contains only the printable ASCII characters, with a 0x20 offset, meaning that the ASCII SPACE character is at index 0, with the resulting code of 0x20. Note this mapping is also equivalent to that used by both the IA5 and the IS-91 encodings. For the former this is defined using CCITT Rec. T.50 Tables 1 and 3. For the latter IS 637 B, Table 4.3.1.4.1-1 -- and note the encoding uses only 6 bits, and hence only maps entries up to the '_' character.
static final byte
UNENCODABLE_7_BIT_CHAR
Character to use when forced to encode otherwise unencodable characters, meaning those not in the respective ASCII or GSM 7-bit encoding tables. Current choice is SPACE, which is 0x20 in both the GSM-7bit and ASCII-7bit encodings.
public static final int
PRINTABLE_ASCII_MIN_INDEX
Only elements between these indices in the ASCII table are printable.
public static final int
ASCII_NL_INDEX
public static final int
ASCII_CR_INDEX
public static final android.util.SparseIntArray
charToAscii
public static final int
ASCII_MAP_BASE_INDEX
Mapping for ASCII values less than 32 are flow control signals and not used here.
public static final int
ASCII_MAP_MAX_INDEX
public com.android.internal.telephony.SmsHeader
userDataHeader
Contains the data header of the user data
public int
msgEncoding
Contains the data encoding type for the SMS message
public boolean
msgEncodingSet
public int
msgType
public int
paddingBits
Number of invalid bits in the last byte of data.
public int
numFields
public byte[]
payload
Contains the user data of a SMS message (See 3GPP2 C.S0015-B, v2, 4.5.2)
public String
payloadStr
Constructors Summary
Methods Summary
public static byte[]stringToAscii(java.lang.String str)
Given a string generate a corresponding ASCII-encoded byte array, but limited to printable characters. If the input contains unprintable characters, return null.

     
        for (int i = 0; i < ASCII_MAP.length; i++) {
            charToAscii.put(ASCII_MAP[i], PRINTABLE_ASCII_MIN_INDEX + i);
        }
        charToAscii.put('\n", ASCII_NL_INDEX);
        charToAscii.put('\r", ASCII_CR_INDEX);
    
        int len = str.length();
        byte[] result = new byte[len];
        for (int i = 0; i < len; i++) {
            int charCode = charToAscii.get(str.charAt(i), -1);
            if (charCode == -1) return null;
            result[i] = (byte)charCode;
        }
        return result;
    
public java.lang.StringtoString()


    
       
        StringBuilder builder = new StringBuilder();
        builder.append("UserData ");
        builder.append("{ msgEncoding=" + (msgEncodingSet ? msgEncoding : "unset"));
        builder.append(", msgType=" + msgType);
        builder.append(", paddingBits=" + paddingBits);
        builder.append(", numFields=" + numFields);
        builder.append(", userDataHeader=" + userDataHeader);
        builder.append(", payload='" + HexDump.toHexString(payload) + "'");
        builder.append(", payloadStr='" + payloadStr + "'");
        builder.append(" }");
        return builder.toString();