B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
   * @param data
   *        A wrapped object containing raw PDU data.
   *
   * @return Decode string.
   *
   * @throws CodeError if decoded content type number is an array.
   * @throws NotWellKnownEncodingError if decoded well-known content type
   *         number is not registered or supported.
   */
@param data
A wrapped object containing raw PDU data.

@return Decode string.

@throws CodeError if decoded content type number is an array.
@throws NotWellKnownEncodingError if decoded well-known content type
number is not registered or supported.
@param data A wrapped object containing raw PDU data . @return Decode string . @throws CodeError if decoded content type number is an array . @throws NotWellKnownEncodingError if decoded well - known content type number is not registered or supported .
function decodeMedia(data) {
    let begin = data.offset, number;
    try {
      number = IntegerValue.decode(data);
    } catch (e) {
      data.offset = begin;
      return NullTerminatedTexts.decode(data).toLowerCase();
    }
    if (typeof number != "number") {
      throw new CodeError("Media: invalid integer type");
    }
    let entry = WSP_WELL_KNOWN_CONTENT_TYPES[number];
    if (!entry) {
      throw new NotWellKnownEncodingError("Media: not well known media " + number);
    }
    return entry.type;
  }
function decodeMedia ( data ) { let begin = data . offset , number ; try { number = IntegerValue . decode ( data ) ; } catch ( e ) { data . offset = begin ; return NullTerminatedTexts . decode ( data ) . toLowerCase ( ) ; } if ( typeof number != "number" ) { throw new CodeError ( "Media: invalid integer type" ) ; } let entry = WSP_WELL_KNOWN_CONTENT_TYPES [ number ] ; if ( ! entry ) { throw new NotWellKnownEncodingError ( "Media: not well known media " + number ) ; } return entry . type ; }
@param data
        A wrapped object containing raw PDU data.
@param data A wrapped object containing raw PDU data .
// `decodeIntegerValue` can return a array, which doesn't apply here.