Mozilla.com

« XPCOM API Reference

Summary

This method returns a block of data copied from the stream.

 [noscript] string read(
   in unsigned long aCount
 );

Parameters

aCount
[in] The maximum number of bytes to read from the stream.

Return Values

This method returns the data read as a string.

Exceptions Thrown

NS_BASE_STREAM_WOULD_BLOCK
Indicates that reading from the input stream would block the calling thread for an indeterminate amount of time. This exception may only be thrown if nsIInputStream::isNonBlocking returns true.

Remarks

Language bindings, such as JavaScript, may interpret null bytes within the stream as null-terminators, and may therefore return a truncated value as the result of this method. It is important to keep this limitation in mind when using the result returned by this method.

It is also important to consider how a language bindings may interpret the string data type. In particular, some bindings may convert the byte values into Unicode code points, by assuming the byte values are encoded as ISO-Latin-1. This is the case for the JavaScript bindings.

Page last modified 21:27, 23 Apr 2006 by Pmash

Files (0)