B2G/gecko/intl/uconv/tests/unit/test_charset_conversion.js
/**
 * Wraps a UTF-16 stream to allow access to the Unicode code points in it.
 *
 * @param stream
 *   the stream to wrap
 * @param bigEndian
 *   true for UTF-16BE, false for UTF-16LE, not present at all for UTF-16 with
 *   a byte-order mark
 */
Wraps a UTF-16 stream to allow access to the Unicode code points in it.
@param stream
the stream to wrap
@param bigEndian
true for UTF-16BE, false for UTF-16LE, not present at all for UTF-16 with
a byte-order mark
Wraps a UTF - 16 stream to allow access to the Unicode code points in it . @param stream the stream to wrap @param bigEndian true for UTF - 16BE false for UTF - 16LE not present at all for UTF - 16 with a byte - order mark
function UTF16(stream, bigEndian)
{
  this._stream = new BIS(stream);
  if (arguments.length > 1)
  {
    this._bigEndian = bigEndian;
  }
  else
  {
    var bom = this._stream.read16();
    if (bom == 0xFEFF)
      this._bigEndian = true;
    else if (bom == 0xFFFE)
      this._bigEndian = false;
    else
      do_throw("missing BOM: " + bom.toString(16).toUpperCase());
  }
}
function UTF16 ( stream , bigEndian ) { this . _stream = new BIS ( stream ) ; if ( arguments . length > 1 ) { this . _bigEndian = bigEndian ; } else { var bom = this . _stream . read16 ( ) ; if ( bom == 0xFEFF ) this . _bigEndian = true ; else if ( bom == 0xFFFE ) this . _bigEndian = false ; else do_throw ( "missing BOM: " + bom . toString ( 16 ) . toUpperCase ( ) ) ; } }
Wraps a UTF-16 stream to allow access to the Unicode code points in it.
Wraps a UTF - 16 stream to allow access to the Unicode code points in it .