B2G/gecko/dom/mobilemessage/src/ril/MmsPduHelper.jsm
/**
   * @param data
   *        A wrapped object to store encoded raw data.
   * @param header
   *        An object containing two attributes: a string-typed `name` and a
   *        `value` of arbitrary type.
   *
   * @throws CodeError if got an empty header name.
   * @throws NotWellKnownEncodingError if the well-known header field number is
   *         not registered or supported.
   */
@param data
A wrapped object to store encoded raw data.
@param header
An object containing two attributes: a string-typed `name` and a
`value` of arbitrary type.

@throws CodeError if got an empty header name.
@throws NotWellKnownEncodingError if the well-known header field number is
not registered or supported.
@param data A wrapped object to store encoded raw data . @param header An object containing two attributes : a string - typed ` name ` and a ` value ` of arbitrary type . @throws CodeError if got an empty header name . @throws NotWellKnownEncodingError if the well - known header field number is not registered or supported .
function encode(data, header) {
    if (!header.name) {
      throw new WSP.CodeError("MMS-header: empty header name");
    }
    let entry = MMS_HEADER_FIELDS[header.name.toLowerCase()];
    if (!entry) {
      throw new WSP.NotWellKnownEncodingError(
        "MMS-header: not well known header " + header.name);
    }
    WSP.ShortInteger.encode(data, entry.number);
    entry.coder.encode(data, header.value);
  }
function encode ( data , header ) { if ( ! header . name ) { throw new WSP . CodeError ( "MMS-header: empty header name" ) ; } let entry = MMS_HEADER_FIELDS [ header . name . toLowerCase ( ) ] ; if ( ! entry ) { throw new WSP . NotWellKnownEncodingError ( "MMS-header: not well known header " + header . name ) ; } WSP . ShortInteger . encode ( data , entry . number ) ; entry . coder . encode ( data , header . value ) ; }
@param data
        A wrapped object to store encoded raw data.
@param data A wrapped object to store encoded raw data .