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

@return A object with a string property `charset`.

@throws CodeError if decoded charset number is an array.
@throws NotWellKnownEncodingError if decoded well-known charset number
is not registered or supported.
@param data A wrapped object containing raw PDU data . @return A object with a string property ` charset ` . @throws CodeError if decoded charset number is an array . @throws NotWellKnownEncodingError if decoded well - known charset number is not registered or supported .
function decode(data) {
    let begin = data.offset;
    try {
      return AcceptCharsetValue.decodeAnyCharset(data);
    } catch (e) {}
    data.offset = begin;
    let numOrArray = IntegerValue.decode(data);
    if (typeof numOrArray != "number") {
      throw new CodeError("Well-known-charset: invalid integer type");
    }
    let charset = numOrArray;
    let entry = WSP_WELL_KNOWN_CHARSETS[charset];
    if (!entry) {
      throw new NotWellKnownEncodingError(
        "Well-known-charset: not well known charset " + charset);
    }
    return {charset: entry.name};
  }
function decode ( data ) { let begin = data . offset ; try { return AcceptCharsetValue . decodeAnyCharset ( data ) ; } catch ( e ) { } data . offset = begin ; let numOrArray = IntegerValue . decode ( data ) ; if ( typeof numOrArray != "number" ) { throw new CodeError ( "Well-known-charset: invalid integer type" ) ; } let charset = numOrArray ; let entry = WSP_WELL_KNOWN_CHARSETS [ charset ] ; if ( ! entry ) { throw new NotWellKnownEncodingError ( "Well-known-charset: not well known charset " + charset ) ; } return { charset : entry . name } ; }
@param data
        A wrapped object containing raw PDU data.
@param data A wrapped object containing raw PDU data .
// `IntegerValue.decode` can return a array, which doesn't apply here.