B2G/gecko/toolkit/components/places/tests/head_common.js
/**
 * Reads data from the provided inputstream.
 *
 * @return an array of bytes.
 */
Reads data from the provided inputstream.
@return an array of bytes.
Reads data from the provided inputstream . @return an array of bytes .
function readInputStreamData(aStream) {
  let bistream = Cc["@mozilla.org/binaryinputstream;1"].
                 createInstance(Ci.nsIBinaryInputStream);
  try {
    bistream.setInputStream(aStream);
    let expectedData = [];
    let avail;
    while ((avail = bistream.available())) {
      expectedData = expectedData.concat(bistream.readByteArray(avail));
    }
    return expectedData;
  } finally {
    bistream.close();
  }
}
function readInputStreamData ( aStream ) { let bistream = Cc [ "@mozilla.org/binaryinputstream;1" ] . createInstance ( Ci . nsIBinaryInputStream ) ; try { bistream . setInputStream ( aStream ) ; let expectedData = [ ] ; let avail ; while ( ( avail = bistream . available ( ) ) ) { expectedData = expectedData . concat ( bistream . readByteArray ( avail ) ) ; } return expectedData ; } finally { bistream . close ( ) ; } }
Reads data from the provided inputstream.
Reads data from the provided inputstream .