Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions
StringUnicharInputStream Class Reference
Inheritance diagram for StringUnicharInputStream:
Inheritance graph
Collaboration diagram for StringUnicharInputStream:
Collaboration graph

List of all members.

Public Member Functions

 StringUnicharInputStream (const nsAString *aString, PRBool aTakeOwnership)
unsigned long read ([array, size_is(aCount)] in PRUnichar aBuf, in unsigned long aCount)
 Reads into a caller-provided character array.
unsigned long readSegments (in nsWriteUnicharSegmentFun aWriter, in voidPtr aClosure, in unsigned long aCount)
 Low-level read method that has access to the stream's underlying buffer.
unsigned long readString (in unsigned long aCount, out AString aString)
 Read into a string object.
void close ()
 Close the stream and free associated resources.

Public Attributes

const nsAString * 
PRUint32 mPos
PRUint32 mLen
PRBool mOwnsString

Private Member Functions

 ~StringUnicharInputStream ()

Detailed Description

Definition at line 53 of file nsUnicharInputStream.cpp.

Constructor & Destructor Documentation

StringUnicharInputStream::StringUnicharInputStream ( const nsAString *  aString,
PRBool  aTakeOwnership 

Definition at line 70 of file nsUnicharInputStream.cpp.

  : mString(aString),

Definition at line 79 of file nsUnicharInputStream.cpp.

  if (mString && mOwnsString) {
    // Some compilers dislike deleting const pointers
    nsAString* mutable_string = NS_CONST_CAST(nsAString*, mString);
    delete mutable_string;

Member Function Documentation

Close the stream and free associated resources.

This also closes the underlying stream, if any.

unsigned long nsIUnicharInputStream::read ( [array, size_is(aCount)] in PRUnichar  aBuf,
in unsigned long  aCount 
) [inherited]

Reads into a caller-provided character array.

The number of characters that were successfully read. May be less than aCount, even if there is more data in the input stream. A return value of 0 means EOF.
To read more than 2^32 characters, call this method multiple times.
unsigned long nsIUnicharInputStream::readSegments ( in nsWriteUnicharSegmentFun  aWriter,
in voidPtr  aClosure,
in unsigned long  aCount 
) [inherited]

Low-level read method that has access to the stream's underlying buffer.

The writer function may be called multiple times for segmented buffers. ReadSegments is expected to keep calling the writer until either there is nothing left to read or the writer returns an error. ReadSegments should not call the writer with zero characters to consume.

aWriterthe "consumer" of the data to be read
aClosureopaque parameter passed to writer
aCountthe maximum number of characters to be read
number of characters read (may be less than aCount)
0 if reached end of file (or if aWriter refused to consume data)
NS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only)
<other-error>on failure

NOTE: this function may be unimplemented if a stream has no underlying buffer

unsigned long nsIUnicharInputStream::readString ( in unsigned long  aCount,
out AString  aString 
) [inherited]

Read into a string object.

aCountThe number of characters that should be read
The number of characters that were read.

Member Data Documentation

Definition at line 63 of file nsUnicharInputStream.cpp.

Definition at line 64 of file nsUnicharInputStream.cpp.

Definition at line 62 of file nsUnicharInputStream.cpp.

NS_DECL_ISUPPORTS NS_DECL_NSIUNICHARINPUTSTREAM const nsAString* StringUnicharInputStream::mString

Definition at line 61 of file nsUnicharInputStream.cpp.

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