Back to index

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

An input stream that allows you to read from a file. More...

import "nsIFileStreams.idl";

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

List of all members.

Public Member Functions

void init (in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags)
void close ()
 Close the stream.
unsigned long available ()
unsigned long read (in charPtr aBuf, in unsigned long aCount)
 Read data from the stream.
unsigned long readSegments (in nsWriteSegmentFun aWriter, in voidPtr aClosure, in unsigned long aCount)
 Low-level read method that has access to the stream's underlying buffer.
boolean isNonBlocking ()

Public Attributes

const long DELETE_ON_CLOSE = 1<<1
 If this is set, the file will be deleted by the time the stream is closed.
const long CLOSE_ON_EOF = 1<<2
 If this is set, the file will close automatically when the end of the file is reached.
const long REOPEN_ON_REWIND = 1<<3
 If this is set, the file will be reopened whenever Seek(0) occurs.

Detailed Description

An input stream that allows you to read from a file.

Definition at line 47 of file nsIFileStreams.idl.


Member Function Documentation

unsigned long nsIInputStream::available ( ) [inherited]
Returns:
number of bytes currently available in the stream
void nsIInputStream::close ( ) [inherited]

Close the stream.

void nsIFileInputStream::init ( in nsIFile  file,
in long  ioFlags,
in long  perm,
in long  behaviorFlags 
)
Parameters:
filefile to read from (must QI to nsILocalFile)
ioFlagsfile open flags listed in prio.h
permfile mode bits listed in prio.h
behaviorFlagsflags specifying various behaviors of the class (see enumerations in the class)
Returns:
true if stream is non-blocking
unsigned long nsIInputStream::read ( in charPtr  aBuf,
in unsigned long  aCount 
) [inherited]

Read data from the stream.

Parameters:
aBufthe buffer into which the data is to be read
aCountthe maximum number of bytes to be read
Returns:
number of bytes read (may be less than aCount).
0 if reached end of file
Exceptions:
NS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only)
<other-error>on failure
unsigned long nsIInputStream::readSegments ( in nsWriteSegmentFun  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 bytes to consume.

Parameters:
aWriterthe "consumer" of the data to be read
aClosureopaque parameter passed to writer
aCountthe maximum number of bytes to be read
Returns:
number of bytes read (may be less than aCount)
0 if reached end of file (or if aWriter refused to consume data)
Exceptions:
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 (e.g., socket input stream).


Member Data Documentation

If this is set, the file will close automatically when the end of the file is reached.

Definition at line 73 of file nsIFileStreams.idl.

If this is set, the file will be deleted by the time the stream is closed.

It may be removed before the stream is closed if it is possible to delete it and still read from it.

If OPEN_ON_READ is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again.

Definition at line 67 of file nsIFileStreams.idl.

If this is set, the file will be reopened whenever Seek(0) occurs.

If the file is already open and the seek occurs, it will happen naturally. (The file will only be reopened if it is closed for some reason.)

Definition at line 80 of file nsIFileStreams.idl.


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