nsIBinaryOutputStream

IID:204ee610-8765-11d3-90cf-0040056a906e
Inherits From:nsIOutputStream

This interface allows writing of primitive data types (integers, floating-point values, booleans, etc.) to a stream in a binary, untagged, fixed-endianness format. This might be used, for example, to implement network protocols or to produce architecture-neutral binary disk files, i.e. ones that can be read and written by both big-endian and little-endian platforms. Output is written in big-endian order (high-order byte first), as this is traditional network order.

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

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

This interface is implemented by the following components:


Methods

void setOutputStream ( nsIOutputStream outputStream ) void write16 ( PRUint16 a16 ) void write32 ( PRUint32 a32 ) void write64 ( PRUint64 a64 ) void write8 ( PRUint8 byte ) void writeBoolean ( PRBool boolean ) void writeByteArray ( arrayof PRUint8 bytes , PRUint32 length ) void writeBytes ( char* string , PRUint32 length ) void writeDouble ( double double ) void writeFloat ( float float ) void writeStringZ ( char* string ) void writeUtf8Z ( PRUnichar* string ) void writeWStringZ ( PRUnichar* string )

void setOutputStream ( nsIOutputStream outputStream )

Arguments:
outputStream

void write16 ( PRUint16 a16 )

Arguments:
a16

void write32 ( PRUint32 a32 )

Arguments:
a32

void write64 ( PRUint64 a64 )

Arguments:
a64

void write8 ( PRUint8 byte )

Arguments:
byte

void writeBoolean ( PRBool boolean )

Arguments:
boolean

void writeByteArray ( arrayof PRUint8 bytes , PRUint32 length )

Write an opaque byte array to a binary stream.

Arguments:
bytes
length

void writeBytes ( char* string , PRUint32 length )

Write an opaque byte array to a binary stream.

Arguments:
string
length

void writeDouble ( double double )

Arguments:
double

void writeFloat ( float float )

Arguments:
float

void writeStringZ ( char* string )

Write a NUL-terminated 8-bit char* string to a binary stream.

Arguments:
string

void writeUtf8Z ( PRUnichar* string )

Write a NUL-terminated UTF8-encoded string to a binary stream, produced from a NUL-terminated 16-bit PRUnichar* string argument.

Arguments:
string

void writeWStringZ ( PRUnichar* string )

Write a NUL-terminated 16-bit PRUnichar* string to a binary stream.

Arguments:
string

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com