Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsIStreamBufferAccess Interface Reference

An interface for access to a buffering stream implementation's underlying memory buffer. More...

import "nsIStreamBufferAccess.idl";

Inheritance diagram for nsIStreamBufferAccess:
Inheritance graph
[legend]
Collaboration diagram for nsIStreamBufferAccess:
Collaboration graph
[legend]

List of all members.

Public Member Functions

charPtr getBuffer (in PRUint32 aLength, in PRUint32 aAlignMask)
 Get access to a contiguous, aligned run of bytes in the stream's buffer.
void putBuffer (in charPtr aBuffer, in PRUint32 aLength)
 Relinquish access to the stream's buffer, filling if at end of an input buffer, flushing if completing an output buffer.
void disableBuffering ()
 Disable and enable buffering on the stream implementing this interface.
void enableBuffering ()

Public Attributes

readonly attribute nsISupports unbufferedStream
 The underlying, unbuffered input or output stream.

Detailed Description

An interface for access to a buffering stream implementation's underlying memory buffer.

Stream implementations that QueryInterface to nsIStreamBufferAccess must ensure that all buffers are aligned on the most restrictive type size for the current architecture (e.g., sizeof(double) for RISCy CPUs). malloc(3) satisfies this requirement.

Definition at line 52 of file nsIStreamBufferAccess.idl.


Member Function Documentation

Disable and enable buffering on the stream implementing this interface.

DisableBuffering flushes an output stream's buffer, and invalidates an input stream's buffer.

charPtr nsIStreamBufferAccess::getBuffer ( in PRUint32  aLength,
in PRUint32  aAlignMask 
)

Get access to a contiguous, aligned run of bytes in the stream's buffer.

Exactly one successful getBuffer call must occur before a putBuffer call taking the non-null pointer returned by the successful getBuffer.

The run of bytes are the next bytes (modulo alignment padding) to read for an input stream, and the next bytes (modulo alignment padding) to store before (eventually) writing buffered data to an output stream. There can be space beyond this run of bytes in the buffer for further accesses before the fill or flush point is reached.

Parameters:
aLengthCount of contiguous bytes requested at the address A that satisfies (A & aAlignMask) == 0 in the buffer, starting from the current stream position, mapped to a buffer address B. The stream implementation must pad from B to A by skipping bytes (if input stream) or storing zero bytes (if output stream).
aAlignMaskBit-mask computed by subtracting 1 from the power-of-two alignment modulus (e.g., 3 or sizeof(PRUint32)-1 for PRUint32 alignment).
Returns:
The aligned pointer to aLength bytes in the buffer, or null if the buffer has no room for aLength bytes starting at the next address A after the current position that satisfies (A & aAlignMask) == 0.
void nsIStreamBufferAccess::putBuffer ( in charPtr  aBuffer,
in PRUint32  aLength 
)

Relinquish access to the stream's buffer, filling if at end of an input buffer, flushing if completing an output buffer.

After a getBuffer call that returns non-null, putBuffer must be called.

Parameters:
aBufferA non-null pointer returned by getBuffer on the same stream buffer access object.
aLengthThe same count of contiguous bytes passed to the getBuffer call that returned aBuffer.

Member Data Documentation

The underlying, unbuffered input or output stream.

Definition at line 109 of file nsIStreamBufferAccess.idl.


The documentation for this interface was generated from the following file: