Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes
nsFileStream Class Reference

#include <nsFileStreams.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISEEKABLESTREAM 
nsFileStream ()
virtual ~nsFileStream ()
nsresult Close ()
nsresult InitWithFileDescriptor (PRFileDesc *fd, nsISupports *parent)
void seek (in long whence, in long long offset)
 seek
long long tell ()
 tell
void setEOF ()
 setEOF

Public Attributes

const PRInt32 NS_SEEK_SET = 0
const PRInt32 NS_SEEK_CUR = 1
const PRInt32 NS_SEEK_END = 2

Protected Attributes

PRFileDescmFD
nsCOMPtr< nsISupports > mParent
PRBool mCloseFD

Detailed Description

Definition at line 56 of file nsFileStreams.h.


Constructor & Destructor Documentation

Definition at line 91 of file nsFileStreams.cpp.

Definition at line 97 of file nsFileStreams.cpp.

{
    if (mCloseFD)
        Close();
}

Here is the call graph for this function:


Member Function Documentation

Reimplemented in nsSafeFileOutputStream.

Definition at line 121 of file nsFileStreams.cpp.

{
    nsresult rv = NS_OK;
    if (mFD) {
        if (mCloseFD)
            if (PR_Close(mFD) == PR_FAILURE)
                rv = NS_BASE_STREAM_OSERROR;
        mFD = nsnull;
    }
    return rv;
}

Here is the caller graph for this function:

nsresult nsFileStream::InitWithFileDescriptor ( PRFileDesc fd,
nsISupports *  parent 
)

Definition at line 106 of file nsFileStreams.cpp.

{
    NS_ENSURE_TRUE(mFD == nsnull, NS_ERROR_ALREADY_INITIALIZED);
    //
    // this file stream is dependent on its parent to keep the
    // file descriptor valid.  an owning reference to the parent
    // prevents the file descriptor from going away prematurely.
    //
    mFD = fd;
    mCloseFD = PR_FALSE;
    mParent = parent;
    return NS_OK;
}
void nsISeekableStream::seek ( in long  whence,
in long long  offset 
) [inherited]

seek

This method moves the stream offset of the steam implementing this interface.

Parameters:
whencespecifies how to interpret the 'offset' parameter in setting the stream offset associated with the implementing stream.
offsetspecifies a value, in bytes, that is used in conjunction with the 'whence' parameter to set the stream offset of the implementing stream. A negative value causes seeking in the reverse direction.

setEOF

This method truncates the stream at the current offset.

tell

This method reports the current offset, in bytes, from the start of the stream.


Member Data Documentation

Definition at line 72 of file nsFileStreams.h.

Definition at line 69 of file nsFileStreams.h.

nsCOMPtr<nsISupports> nsFileStream::mParent [protected]

Definition at line 70 of file nsFileStreams.h.

Definition at line 62 of file nsISeekableStream.idl.

Definition at line 68 of file nsISeekableStream.idl.

Definition at line 56 of file nsISeekableStream.idl.


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