nsIBinaryInputStream 编辑
xpcom/io/nsIBinaryInputStream.idl
Scriptable
This interface allows consumption of primitive data types from a "binary stream" containing untagged, big-endian binary data, that is 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, that is ones that can be read and written by both big-endian and little-endian platforms.
Inherits from: nsIInputStream
Last changed in Gecko 1.7
Method overview
PRUint8 read8(); |
PRUint16 read16(); |
PRUint32 read32(); |
PRUint64 read64(); |
unsigned long readArrayBuffer(in PRUint32 aLength, in jsval aArrayBuffer); |
PRBool readBoolean(); |
void readByteArray(in PRUint32 aLength, [array, size_is(aLength), retval] out PRUint8 aBytes); |
void readBytes(in PRUint32 aLength, [size_is(aLength), retval] out string aString); |
ACString readCString(); |
double readDouble(); |
float readFloat(); |
AString readString(); |
void setInputStream(in nsIInputStream aInputStream); |
Methods
read8()
Reads from the stream.
PRUint8 read8();
Parameters
None.
Return value
An 8-bit integer read from the stream.
read16()
Reads from the stream.
PRUint16 read16();
Parameters
None.
Return value
A 16-bit integer read from the stream.
read32()
Reads from the stream.
PRUint32 read32();
Parameters
None.
Return value
A 32-bit integer read from the stream.
read64()
Reads from the stream.
Warning: This method is available from JavaScript; however JavaScript does not support 64-bit integers.PRUint64 read64();
Parameters
None.
Return value
A 64-bit integer read from the stream.
readArrayBuffer()
Read opaque bytes from the stream, storing the results in an ArrayBuffer.
unsigned long readArrayBuffer(in PRUint32 aLength, in jsval aArrayBuffer);
Parameters
aLength
- The number of bytes that should be read.
aArrayBuffer
- The arraybuffer in which to store the results.
Return value
The number of bytes actually read into aArrayBuffer.
readBoolean()
Reads an 8-bit value from the stream, treating it as a Boolean value.
PRBool readBoolean();
Parameters
None.
Return value
A boolean value read from the stream.
readByteArray()
Reads an opaque byte array from the stream, storing the results as an array of PRUint8s.
void readByteArray( in PRUint32 aLength, [array, size_is(aLength), retval] out PRUint8 aBytes );
Parameters
aLength
- The number of bytes that must be read.
aBytes
- An array containing the bytes read from the stream.
Exceptions thrown
NS_ERROR_FAILURE
- If it can't read aLength bytes.
readBytes()
Reads an opaque byte array from the stream.
void readBytes( in PRUint32 aLength, [size_is(aLength), retval] out string aString );
Parameters
aLength
- The number of bytes to read.
aString
- A string containing the bytes read from the stream.
Exceptions thrown
NS_ERROR_FAILURE
- If it can't read aLength bytes.
readCString()
Reads an 8-bit pascal style string from the stream. 32-bit length field, followed by length 8-bit chars.
ACString readCString();
Parameters
None.
Return value
The string read from the stream.
readDouble()
Reads from the stream.
double readDouble();
Parameters
None.
Return value
A double
read from the stream.
readFloat()
Reads from the stream.
float readFloat();
Parameters
None.
Return value
A float
read from the stream.
readString()
Reads an 16-bit pascal style string from the stream. 32-bit length field, followed by length PRUnichars.
AString readString();
Parameters
None.
Return value
The string read from the stream.
setInputStream()
void setInputStream( in nsIInputStream aInputStream );
Parameters
aInputStream
- The stream from which to read.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论