Bug 331996 nsIBinaryInputStream.readString/nsIBinaryInputStream.readCString and nsBinaryInputStream.readString/nsBinaryInputStream.readCString don't agree

r=darin
This commit is contained in:
timeless%mozdev.org 2006-10-16 08:01:00 +00:00
parent 716c565b11
commit caf7787fb9
2 changed files with 30 additions and 10 deletions

View File

@ -54,6 +54,11 @@
interface nsIBinaryInputStream : nsIInputStream {
void setInputStream(in nsIInputStream aInputStream);
/**
* Read 8-bits from the stream.
*
* @return that byte to be treated as a boolean.
*/
PRBool readBoolean();
PRUint8 read8();
@ -65,24 +70,34 @@ interface nsIBinaryInputStream : nsIInputStream {
double readDouble();
/**
* Read a NUL-terminated 8-bit char* string from a binary stream.
* Read an 8-bit pascal style string from the stream.
* 32-bit length field, followed by length 8-bit chars.
*/
ACString readCString();
/**
* Read a NUL-terminated 16-bit PRUnichar* string from a binary stream.
* Read an 16-bit pascal style string from the stream.
* 32-bit length field, followed by length PRUnichars.
*/
AString readString();
/**
* Read an opaque byte array from a binary stream.
* Read an opaque byte array from the stream.
*
* @param aLength the number of bytes that must be read.
*
* @throws NS_ERROR_FAILURE if it can't read aLength bytes
*/
void readBytes(in PRUint32 aLength,
[size_is(aLength), retval] out string aString);
/**
* Read an opaque byte array from a binary stream, storing the results
* Read an opaque byte array from the stream, storing the results
* as an array of PRUint8s.
*
* @param aLength the number of bytes that must be read.
*
* @throws NS_ERROR_FAILURE if it can't read aLength bytes
*/
void readByteArray(in PRUint32 aLength,
[array, size_is(aLength), retval] out PRUint8 aBytes);

View File

@ -55,6 +55,9 @@
interface nsIBinaryOutputStream : nsIOutputStream {
void setOutputStream(in nsIOutputStream aOutputStream);
/**
* Write a boolean as an 8-bit char to the stream.
*/
void writeBoolean(in PRBool aBoolean);
void write8(in PRUint8 aByte);
@ -66,28 +69,30 @@ interface nsIBinaryOutputStream : nsIOutputStream {
void writeDouble(in double aDouble);
/**
* Write a NUL-terminated 8-bit char* string to a binary stream.
* Write an 8-bit pascal style string to the stream.
* 32-bit length field, followed by length 8-bit chars.
*/
void writeStringZ(in string aString);
/**
* Write a NUL-terminated 16-bit PRUnichar* string to a binary stream.
* Write a 16-bit pascal style string to the stream.
* 32-bit length field, followed by length PRUnichars.
*/
void writeWStringZ(in wstring aString);
/**
* Write a NUL-terminated UTF8-encoded string to a binary stream, produced
* from a NUL-terminated 16-bit PRUnichar* string argument.
* Write an 8-bit pascal style string (UTF8-encoded) to the stream.
* 32-bit length field, followed by length 8-bit chars.
*/
void writeUtf8Z(in wstring aString);
/**
* Write an opaque byte array to a binary stream.
* Write an opaque byte array to the stream.
*/
void writeBytes([size_is(aLength)] in string aString, in PRUint32 aLength);
/**
* Write an opaque byte array to a binary stream.
* Write an opaque byte array to the stream.
*/
void writeByteArray([array, size_is(aLength)] in PRUint8 aBytes,
in PRUint32 aLength);