FileDocCategorySizeDatePackage
PduHeaders.javaAPI DocAndroid 1.5 API31245Wed May 06 22:41:56 BST 2009com.google.android.mms.pdu

PduHeaders

public class PduHeaders extends Object

Fields Summary
public static final int
BCC
All pdu header fields.
public static final int
CC
public static final int
CONTENT_LOCATION
public static final int
CONTENT_TYPE
public static final int
DATE
public static final int
DELIVERY_REPORT
public static final int
DELIVERY_TIME
public static final int
EXPIRY
public static final int
FROM
public static final int
MESSAGE_CLASS
public static final int
MESSAGE_ID
public static final int
MESSAGE_TYPE
public static final int
MMS_VERSION
public static final int
MESSAGE_SIZE
public static final int
PRIORITY
public static final int
READ_REPLY
public static final int
READ_REPORT
public static final int
REPORT_ALLOWED
public static final int
RESPONSE_STATUS
public static final int
RESPONSE_TEXT
public static final int
SENDER_VISIBILITY
public static final int
STATUS
public static final int
SUBJECT
public static final int
TO
public static final int
TRANSACTION_ID
public static final int
RETRIEVE_STATUS
public static final int
RETRIEVE_TEXT
public static final int
READ_STATUS
public static final int
REPLY_CHARGING
public static final int
REPLY_CHARGING_DEADLINE
public static final int
REPLY_CHARGING_ID
public static final int
REPLY_CHARGING_SIZE
public static final int
PREVIOUSLY_SENT_BY
public static final int
PREVIOUSLY_SENT_DATE
public static final int
STORE
public static final int
MM_STATE
public static final int
MM_FLAGS
public static final int
STORE_STATUS
public static final int
STORE_STATUS_TEXT
public static final int
STORED
public static final int
ATTRIBUTES
public static final int
TOTALS
public static final int
MBOX_TOTALS
public static final int
QUOTAS
public static final int
MBOX_QUOTAS
public static final int
MESSAGE_COUNT
public static final int
CONTENT
public static final int
START
public static final int
ADDITIONAL_HEADERS
public static final int
DISTRIBUTION_INDICATOR
public static final int
ELEMENT_DESCRIPTOR
public static final int
LIMIT
public static final int
RECOMMENDED_RETRIEVAL_MODE
public static final int
RECOMMENDED_RETRIEVAL_MODE_TEXT
public static final int
STATUS_TEXT
public static final int
APPLIC_ID
public static final int
REPLY_APPLIC_ID
public static final int
AUX_APPLIC_ID
public static final int
CONTENT_CLASS
public static final int
DRM_CONTENT
public static final int
ADAPTATION_ALLOWED
public static final int
REPLACE_ID
public static final int
CANCEL_ID
public static final int
CANCEL_STATUS
public static final int
MESSAGE_TYPE_SEND_REQ
X-Mms-Message-Type field types.
public static final int
MESSAGE_TYPE_SEND_CONF
public static final int
MESSAGE_TYPE_NOTIFICATION_IND
public static final int
MESSAGE_TYPE_NOTIFYRESP_IND
public static final int
MESSAGE_TYPE_RETRIEVE_CONF
public static final int
MESSAGE_TYPE_ACKNOWLEDGE_IND
public static final int
MESSAGE_TYPE_DELIVERY_IND
public static final int
MESSAGE_TYPE_READ_REC_IND
public static final int
MESSAGE_TYPE_READ_ORIG_IND
public static final int
MESSAGE_TYPE_FORWARD_REQ
public static final int
MESSAGE_TYPE_FORWARD_CONF
public static final int
MESSAGE_TYPE_MBOX_STORE_REQ
public static final int
MESSAGE_TYPE_MBOX_STORE_CONF
public static final int
MESSAGE_TYPE_MBOX_VIEW_REQ
public static final int
MESSAGE_TYPE_MBOX_VIEW_CONF
public static final int
MESSAGE_TYPE_MBOX_UPLOAD_REQ
public static final int
MESSAGE_TYPE_MBOX_UPLOAD_CONF
public static final int
MESSAGE_TYPE_MBOX_DELETE_REQ
public static final int
MESSAGE_TYPE_MBOX_DELETE_CONF
public static final int
MESSAGE_TYPE_MBOX_DESCR
public static final int
MESSAGE_TYPE_DELETE_REQ
public static final int
MESSAGE_TYPE_DELETE_CONF
public static final int
MESSAGE_TYPE_CANCEL_REQ
public static final int
MESSAGE_TYPE_CANCEL_CONF
public static final int
VALUE_YES
X-Mms-Delivery-Report | X-Mms-Read-Report | X-Mms-Report-Allowed | X-Mms-Sender-Visibility | X-Mms-Store | X-Mms-Stored | X-Mms-Totals | X-Mms-Quotas | X-Mms-Distribution-Indicator | X-Mms-DRM-Content | X-Mms-Adaptation-Allowed | field types.
public static final int
VALUE_NO
public static final int
VALUE_ABSOLUTE_TOKEN
Delivery-Time | Expiry and Reply-Charging-Deadline | field type components.
public static final int
VALUE_RELATIVE_TOKEN
public static final int
MMS_VERSION_1_3
X-Mms-MMS-Version field types.
public static final int
MMS_VERSION_1_2
public static final int
MMS_VERSION_1_1
public static final int
MMS_VERSION_1_0
public static final int
CURRENT_MMS_VERSION
public static final int
FROM_ADDRESS_PRESENT_TOKEN
From field type components.
public static final int
FROM_INSERT_ADDRESS_TOKEN
public static final String
FROM_ADDRESS_PRESENT_TOKEN_STR
public static final String
FROM_INSERT_ADDRESS_TOKEN_STR
public static final int
STATUS_EXPIRED
X-Mms-Status Field.
public static final int
STATUS_RETRIEVED
public static final int
STATUS_REJECTED
public static final int
STATUS_DEFERRED
public static final int
STATUS_UNRECOGNIZED
public static final int
STATUS_INDETERMINATE
public static final int
STATUS_FORWARDED
public static final int
STATUS_UNREACHABLE
public static final int
MM_FLAGS_ADD_TOKEN
MM-Flags field type components.
public static final int
MM_FLAGS_REMOVE_TOKEN
public static final int
MM_FLAGS_FILTER_TOKEN
public static final int
MESSAGE_CLASS_PERSONAL
X-Mms-Message-Class field types.
public static final int
MESSAGE_CLASS_ADVERTISEMENT
public static final int
MESSAGE_CLASS_INFORMATIONAL
public static final int
MESSAGE_CLASS_AUTO
public static final String
MESSAGE_CLASS_PERSONAL_STR
public static final String
MESSAGE_CLASS_ADVERTISEMENT_STR
public static final String
MESSAGE_CLASS_INFORMATIONAL_STR
public static final String
MESSAGE_CLASS_AUTO_STR
public static final int
PRIORITY_LOW
X-Mms-Priority field types.
public static final int
PRIORITY_NORMAL
public static final int
PRIORITY_HIGH
public static final int
RESPONSE_STATUS_OK
X-Mms-Response-Status field types.
public static final int
RESPONSE_STATUS_ERROR_UNSPECIFIED
public static final int
RESPONSE_STATUS_ERROR_SERVICE_DENIED
public static final int
RESPONSE_STATUS_ERROR_MESSAGE_FORMAT_CORRUPT
public static final int
RESPONSE_STATUS_ERROR_SENDING_ADDRESS_UNRESOLVED
public static final int
RESPONSE_STATUS_ERROR_MESSAGE_NOT_FOUND
public static final int
RESPONSE_STATUS_ERROR_NETWORK_PROBLEM
public static final int
RESPONSE_STATUS_ERROR_CONTENT_NOT_ACCEPTED
public static final int
RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE
public static final int
RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE
public static final int
RESPONSE_STATUS_ERROR_TRANSIENT_SENDNG_ADDRESS_UNRESOLVED
public static final int
RESPONSE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND
public static final int
RESPONSE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM
public static final int
RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_FAILURE
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_SERVICE_DENIED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID
public static final int
RESPONSE_STATUS_ERROR_PERMANENT_END
public static final int
RETRIEVE_STATUS_OK
X-Mms-Retrieve-Status field types.
public static final int
RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE
public static final int
RETRIEVE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND
public static final int
RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM
public static final int
RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE
public static final int
RETRIEVE_STATUS_ERROR_PERMANENT_SERVICE_DENIED
public static final int
RETRIEVE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND
public static final int
RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED
public static final int
RETRIEVE_STATUS_ERROR_END
public static final int
SENDER_VISIBILITY_HIDE
X-Mms-Sender-Visibility field types.
public static final int
SENDER_VISIBILITY_SHOW
public static final int
READ_STATUS_READ
X-Mms-Read-Status field types.
public static final int
READ_STATUS__DELETED_WITHOUT_BEING_READ
public static final int
CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED
X-Mms-Cancel-Status field types.
public static final int
CANCEL_STATUS_REQUEST_CORRUPTED
public static final int
REPLY_CHARGING_REQUESTED
X-Mms-Reply-Charging field types.
public static final int
REPLY_CHARGING_REQUESTED_TEXT_ONLY
public static final int
REPLY_CHARGING_ACCEPTED
public static final int
REPLY_CHARGING_ACCEPTED_TEXT_ONLY
public static final int
MM_STATE_DRAFT
X-Mms-MM-State field types.
public static final int
MM_STATE_SENT
public static final int
MM_STATE_NEW
public static final int
MM_STATE_RETRIEVED
public static final int
MM_STATE_FORWARDED
public static final int
RECOMMENDED_RETRIEVAL_MODE_MANUAL
X-Mms-Recommended-Retrieval-Mode field types.
public static final int
CONTENT_CLASS_TEXT
X-Mms-Content-Class field types.
public static final int
CONTENT_CLASS_IMAGE_BASIC
public static final int
CONTENT_CLASS_IMAGE_RICH
public static final int
CONTENT_CLASS_VIDEO_BASIC
public static final int
CONTENT_CLASS_VIDEO_RICH
public static final int
CONTENT_CLASS_MEGAPIXEL
public static final int
CONTENT_CLASS_CONTENT_BASIC
public static final int
CONTENT_CLASS_CONTENT_RICH
public static final int
STORE_STATUS_SUCCESS
X-Mms-Store-Status field types.
public static final int
STORE_STATUS_ERROR_TRANSIENT_FAILURE
public static final int
STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM
public static final int
STORE_STATUS_ERROR_PERMANENT_FAILURE
public static final int
STORE_STATUS_ERROR_PERMANENT_SERVICE_DENIED
public static final int
STORE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT
public static final int
STORE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND
public static final int
STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL
public static final int
STORE_STATUS_ERROR_END
private HashMap
mHeaderMap
The map contains the value of all headers.
Constructors Summary
public PduHeaders()
Constructor of PduHeaders.


            
      
        mHeaderMap = new HashMap<Integer, Object>();
    
Methods Summary
protected voidappendEncodedStringValue(EncodedStringValue value, int field)
Append one EncodedStringValue to another.

param
value the EncodedStringValue to append
param
field the field
throws
NullPointerException if the value is null.

        if (null == value) {
            throw new NullPointerException();
        }

        switch (field) {
            case BCC:
            case CC:
            case TO:
                break;
            default:
                throw new RuntimeException("Invalid header field!");
        }

        ArrayList<EncodedStringValue> list =
            (ArrayList<EncodedStringValue>) mHeaderMap.get(field);
        if (null == list) {
            list  = new ArrayList<EncodedStringValue>();
        }
        list.add(value);
        mHeaderMap.put(field, list);
    
protected EncodedStringValuegetEncodedStringValue(int field)
Get EncodedStringValue value by header field.

param
field the field
return
the EncodedStringValue value of the pdu header with specified header field

        return (EncodedStringValue) mHeaderMap.get(field);
    
protected EncodedStringValue[]getEncodedStringValues(int field)
Get TO, CC or BCC header value.

param
field the field
return
the EncodeStringValue array of the pdu header with specified header field

        ArrayList<EncodedStringValue> list =
                (ArrayList<EncodedStringValue>) mHeaderMap.get(field);
        if (null == list) {
            return null;
        }
        EncodedStringValue[] values = new EncodedStringValue[list.size()];
        return list.toArray(values);
    
protected longgetLongInteger(int field)
Get LongInteger value by header field.

param
field the field
return
the LongInteger value of the pdu header with specified header field. if return -1, the field is not existed in pdu header.

        Long longInteger = (Long) mHeaderMap.get(field);
        if (null == longInteger) {
            return -1;
        }

        return longInteger.longValue();
    
protected intgetOctet(int field)
Get octet value by header field.

param
field the field
return
the octet value of the pdu header with specified header field. Return 0 if the value is not set.

        Integer octet = (Integer) mHeaderMap.get(field);
        if (null == octet) {
            return 0;
        }

        return octet;
    
protected byte[]getTextString(int field)
Get TextString value by header field.

param
field the field
return
the TextString value of the pdu header with specified header field

        return (byte[]) mHeaderMap.get(field);
    
protected voidsetEncodedStringValue(EncodedStringValue value, int field)
Set EncodedStringValue value to pdu header by header field.

param
value the value
param
field the field
return
the EncodedStringValue value of the pdu header with specified header field
throws
NullPointerException if the value is null.

        /**
         * Check whether this field can be set for specific
         * header and check validity of the field.
         */
        if (null == value) {
            throw new NullPointerException();
        }

        switch (field) {
            case SUBJECT:
            case RECOMMENDED_RETRIEVAL_MODE_TEXT:
            case RETRIEVE_TEXT:
            case STATUS_TEXT:
            case STORE_STATUS_TEXT:
            case RESPONSE_TEXT:
            case FROM:
            case PREVIOUSLY_SENT_BY:
            case MM_FLAGS:
                break;
            default:
                // This header value should not be Encoded-String-Value.
                throw new RuntimeException("Invalid header field!");
        }

        mHeaderMap.put(field, value);
    
protected voidsetEncodedStringValues(EncodedStringValue[] value, int field)
Set TO, CC or BCC header value.

param
value the value
param
field the field
return
the EncodedStringValue value array of the pdu header with specified header field
throws
NullPointerException if the value is null.

        /**
         * Check whether this field can be set for specific
         * header and check validity of the field.
         */
        if (null == value) {
            throw new NullPointerException();
        }

        switch (field) {
            case BCC:
            case CC:
            case TO:
                break;
            default:
                // This header value should not be Encoded-String-Value.
                throw new RuntimeException("Invalid header field!");
        }

        ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
        for (int i = 0; i < value.length; i++) {
            list.add(value[i]);
        }
        mHeaderMap.put(field, list);
    
protected voidsetLongInteger(long value, int field)
Set LongInteger value to pdu header by header field.

param
value the value
param
field the field

        /**
         * Check whether this field can be set for specific
         * header and check validity of the field.
         */
        switch (field) {
            case DATE:
            case REPLY_CHARGING_SIZE:
            case MESSAGE_SIZE:
            case MESSAGE_COUNT:
            case START:
            case LIMIT:
            case DELIVERY_TIME:
            case EXPIRY:
            case REPLY_CHARGING_DEADLINE:
            case PREVIOUSLY_SENT_DATE:
                break;
            default:
                // This header value should not be LongInteger.
                throw new RuntimeException("Invalid header field!");
        }
        mHeaderMap.put(field, value);
    
protected voidsetOctet(int value, int field)
Set octet value to pdu header by header field.

param
value the value
param
field the field
throws
InvalidHeaderValueException if the value is invalid.

        /**
         * Check whether this field can be set for specific
         * header and check validity of the field.
         */
        switch (field) {
            case REPORT_ALLOWED:
            case ADAPTATION_ALLOWED:
            case DELIVERY_REPORT:
            case DRM_CONTENT:
            case DISTRIBUTION_INDICATOR:
            case QUOTAS:
            case READ_REPORT:
            case STORE:
            case STORED:
            case TOTALS:
            case SENDER_VISIBILITY:
                if ((VALUE_YES != value) && (VALUE_NO != value)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case READ_STATUS:
                if ((READ_STATUS_READ != value) &&
                        (READ_STATUS__DELETED_WITHOUT_BEING_READ != value)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case CANCEL_STATUS:
                if ((CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED != value) &&
                        (CANCEL_STATUS_REQUEST_CORRUPTED != value)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case PRIORITY:
                if ((value < PRIORITY_LOW) || (value > PRIORITY_HIGH)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case STATUS:
                if ((value < STATUS_EXPIRED) || (value > STATUS_UNREACHABLE)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case REPLY_CHARGING:
                if ((value < REPLY_CHARGING_REQUESTED)
                        || (value > REPLY_CHARGING_ACCEPTED_TEXT_ONLY)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case MM_STATE:
                if ((value < MM_STATE_DRAFT) || (value > MM_STATE_FORWARDED)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case RECOMMENDED_RETRIEVAL_MODE:
                if (RECOMMENDED_RETRIEVAL_MODE_MANUAL != value) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case CONTENT_CLASS:
                if ((value < CONTENT_CLASS_TEXT)
                        || (value > CONTENT_CLASS_CONTENT_RICH)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            case RETRIEVE_STATUS:
                // According to oma-ts-mms-enc-v1_3, section 7.3.50, we modify the invalid value.
                if ((value > RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
                        (value < RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE)) {
                    value = RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE;
                } else if ((value > RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED) &&
                        (value <= RETRIEVE_STATUS_ERROR_END)) {
                    value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
                } else if ((value < RETRIEVE_STATUS_OK) ||
                        ((value > RETRIEVE_STATUS_OK) &&
                                (value < RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
                                (value > RETRIEVE_STATUS_ERROR_END)) {
                    value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
                }
                break;
            case STORE_STATUS:
                // According to oma-ts-mms-enc-v1_3, section 7.3.58, we modify the invalid value.
                if ((value > STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
                        (value < STORE_STATUS_ERROR_PERMANENT_FAILURE)) {
                    value = STORE_STATUS_ERROR_TRANSIENT_FAILURE;
                } else if ((value > STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL) &&
                        (value <= STORE_STATUS_ERROR_END)) {
                    value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
                } else if ((value < STORE_STATUS_SUCCESS) ||
                        ((value > STORE_STATUS_SUCCESS) &&
                                (value < STORE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
                                (value > STORE_STATUS_ERROR_END)) {
                    value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
                }
                break;
            case RESPONSE_STATUS:
                // According to oma-ts-mms-enc-v1_3, section 7.3.48, we modify the invalid value.
                if ((value > RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS) &&
                        (value < RESPONSE_STATUS_ERROR_PERMANENT_FAILURE)) {
                    value = RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE;
                } else if (((value > RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID) &&
                        (value <= RESPONSE_STATUS_ERROR_PERMANENT_END)) ||
                        (value < RESPONSE_STATUS_OK) ||
                        ((value > RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE) &&
                                (value < RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
                                (value > RESPONSE_STATUS_ERROR_PERMANENT_END)) {
                    value = RESPONSE_STATUS_ERROR_PERMANENT_FAILURE;
                }
                break;
            case MMS_VERSION:
                if ((value < MMS_VERSION_1_0)|| (value > MMS_VERSION_1_3)) {
                    value = CURRENT_MMS_VERSION; // Current version is the default value.
                }
                break;
            case MESSAGE_TYPE:
                if ((value < MESSAGE_TYPE_SEND_REQ) || (value > MESSAGE_TYPE_CANCEL_CONF)) {
                    // Invalid value.
                    throw new InvalidHeaderValueException("Invalid Octet value!");
                }
                break;
            default:
                // This header value should not be Octect.
                throw new RuntimeException("Invalid header field!");
        }
        mHeaderMap.put(field, value);
    
protected voidsetTextString(byte[] value, int field)
Set TextString value to pdu header by header field.

param
value the value
param
field the field
return
the TextString value of the pdu header with specified header field
throws
NullPointerException if the value is null.

        /**
         * Check whether this field can be set for specific
         * header and check validity of the field.
         */
        if (null == value) {
            throw new NullPointerException();
        }

        switch (field) {
            case TRANSACTION_ID:
            case REPLY_CHARGING_ID:
            case AUX_APPLIC_ID:
            case APPLIC_ID:
            case REPLY_APPLIC_ID:
            case MESSAGE_ID:
            case REPLACE_ID:
            case CANCEL_ID:
            case CONTENT_LOCATION:
            case MESSAGE_CLASS:
            case CONTENT_TYPE:
                break;
            default:
                // This header value should not be Text-String.
                throw new RuntimeException("Invalid header field!");
        }
        mHeaderMap.put(field, value);