xpcom/io/nsIBinaryOutputStream.idlScriptable
This interface allows writing of primitive data types (integers, floating-point values, booleans, and so on.) 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, that is 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.
Inherits from: nsIOutputStream Last changed in Gecko 1.7

Method overview

void setOutputStream(in nsIOutputStream aOutputStream);
void write8(in PRUint8 aByte);
void write16(in PRUint16 a16);
void write32(in PRUint32 a32);
void write64(in PRUint64 a64);
void writeBoolean(in PRBool aBoolean);
void writeByteArray([array, size_is(aLength)] in PRUint8 aBytes, in PRUint32 aLength);
void writeBytes(aLength)] in string aString, in PRUint32 aLength);
void writeDouble(in double aDouble);
void writeFloat(in float aFloat);
void writeStringZ(in string aString);
void writeUtf8Z(in wstring aString);
void writeWStringZ(in wstring aString);

Methods

setOutputStream()

Sets the stream to which output is directed.

void setOutputStream(
  in nsIOutputStream aOutputStream
);
Parameters
aOutputStream
Instance of the nsIOutputStream object to which output should be directed.

write8()

Writes an 8-bit integer to the stream.

void write8(
  in PRUint8 aByte
);
Parameters
aByte
The byte to write to the stream.

write16()

Writes a 16-bit integer to the stream.

void write16(
  in PRUint16 a16
);
Parameters
a16
The 16-bit integer to write to the stream.

write32()

Writes a 32-bit integer to the stream.

void write32(
  in PRUint32 a32
);
Parameters
a32
The 32-bit integer to write to the stream.

write64()

Writes a 64-bit integer to the stream.

void write64(
  in PRUint64 a64
);
Parameters
a64
The 64-bit integer to write to the stream.

writeBoolean()

Writes a boolean value (as a byte) to the stream.

void writeBoolean(
  in PRBool aBoolean
);
Parameters
aBoolean
The Boolean value to write to the stream; the value will consist of one byte in the output stream.

writeByteArray()

Writes an opaque byte array to the stream.

void writeByteArray(
  [array, size_is(aLength)] in PRUint8 aBytes,
  in PRUint32 aLength
);
Parameters
aBytes
The bytes to write to the stream.
aLength
The number of bytes to write to the stream.

writeBytes()

Writes an opaque byte array to the stream.

void writeBytes(
  [size_is(aLength)] in string aString,
  in PRUint32 aLength
);
Parameters
aString
The byte array to write to the stream.
aLength
The number of bytes to write to the stream.

writeDouble()

Writes a double precision floating point number to the stream.

void writeDouble(
  in double aDouble
);
Parameters
aDouble
The double to write to the stream.

writeFloat()

Writes a floating point number to the stream.

void writeFloat(
  in float aFloat
);
Parameters
aFloat
The floating point value to write to the stream.

writeStringZ()

Writes an 8-bit pascal style string to the stream. The output data consists of a 32-bit length field, followed by that many 8-bit characters.

void writeStringZ(
  in string aString
);
Parameters
aString
The string to write to the stream.

writeUtf8Z()

Writes an 8-bit pascal style string (UTF8-encoded) to the stream. The output data consists of a 32-bit length field, followed by that many 8-bit characters.

void writeUtf8Z(
  in wstring aString
);
Parameters
aString
The string to write to the stream.

writeWStringZ()

Writes a 16-bit pascal style string to the stream. The output data consists of a 32-bit length field, followed by that many PRUnichars.

void writeWStringZ(
  in wstring aString
);
Parameters
aString
The string to write to the stream.

See also