nsIScriptableInputStream

nsIScriptableInputStream provides scriptable access to an nsIInputStream
instance.

Methods

close()

Closes the stream.

init(aInputStream)

Wrap the given nsIInputStream with this nsIScriptableInputStream.

Parameters

aInputStream parameter providing the stream to wrap

available()

Return the number of bytes currently available in the stream

@throws NS_BASE_STREAM_CLOSED if called after the stream has been closed

Returns

the number of bytes

read(aCount)

Read data from the stream.

WARNING: If the data contains a null byte, then this method will return
a truncated string.

@throws NS_BASE_STREAM_CLOSED if called after the stream has been closed
@throws NS_ERROR_NOT_INITIALIZED if init was not called

Parameters

aCount the maximum number of bytes to read

Returns

the data, which will be an empty string if the stream is at EOF.

readBytes(aCount)

Read data from the stream, including NULL bytes.

@throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream
would block the calling thread (non-blocking mode only).
@throws NS_ERROR_FAILURE if there are not enough bytes available to read
aCount amount of data.

Parameters

aCount the maximum number of bytes to read.

Returns

the data from the stream, which will be an empty string if EOF has been reached.