WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIBinaryInputStream

IID:7b456cb0-8772-11d3-90cf-0040056a906e
Inherits From:nsIInputStream

This interface allows consumption of primitive data types from a "binary stream" containing untagged, big-endian binary data, i.e. as produced by an implementation of nsIBinaryOutputStream. This might be used, for example, to implement network protocols or to read from architecture-neutral disk files, i.e. ones that can be read and written by both big-endian and little-endian platforms.

This interface is intended to be used as an instance. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/binaryinputstream;1"].
            createInstance(Components.interfaces.nsIBinaryInputStream);

This interface is implemented by the following components:


Methods

PRUint16 read16 ( ) PRUint32 read32 ( ) PRUint64 read64 ( ) PRUint8 read8 ( ) PRBool readBoolean ( ) void readByteArray ( PRUint32 length , out arrayof PRUint8 bytes ) void readBytes ( PRUint32 length , out char* string ) ACString readCString ( ) double readDouble ( ) float readFloat ( ) AString readString ( ) void setInputStream ( nsIInputStream inputStream )

PRUint16 read16 ( )


PRUint32 read32 ( )


PRUint64 read64 ( )


PRUint8 read8 ( )


PRBool readBoolean ( )

Read 8-bits from the stream.

Returns:
that byte to be treated as a boolean.

void readByteArray ( PRUint32 length , out arrayof PRUint8 bytes )

Read an opaque byte array from the stream, storing the results as an array of PRUint8s.

Arguments:
length: the number of bytes that must be read.
bytes

void readBytes ( PRUint32 length , out char* string )

Read an opaque byte array from the stream.

Arguments:
length: the number of bytes that must be read.
string

ACString readCString ( )

Read an 8-bit pascal style string from the stream. 32-bit length field, followed by length 8-bit chars.


double readDouble ( )


float readFloat ( )


AString readString ( )

Read an 16-bit pascal style string from the stream. 32-bit length field, followed by length PRUnichars.


void setInputStream ( nsIInputStream inputStream )

Arguments:
inputStream

Reference documentation is generated from Mozilla's source.