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 writeBoolean ( PRBool boolean )
Write a boolean as an 8-bit char to the stream.
- Arguments:
- boolean
void writeByteArray ( arrayof PRUint8 bytes , PRUint32 length )
Write an opaque byte array to the stream.
- Arguments:
- bytes
- length
void writeBytes ( char* string , PRUint32 length )
Write an opaque byte array to the stream.
- Arguments:
- string
- length
void writeStringZ ( char* string )
Write an 8-bit pascal style string to the stream. 32-bit length field, followed by length 8-bit chars.
- Arguments:
- string
void writeUtf8Z ( PRUnichar* string )
Write an 8-bit pascal style string (UTF8-encoded) to the stream. 32-bit length field, followed by length 8-bit chars.
- Arguments:
- string
void writeWStringZ ( PRUnichar* string )
Write a 16-bit pascal style string to the stream. 32-bit length field, followed by length PRUnichars.
- Arguments:
- string
Reference documentation is generated from Mozilla's source.
