nsIBinaryOutputStream 编辑

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:102 次

字数:8546

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文