Inherits From:nsIInputStream

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

This interface is intended to be used as an instance. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/network/file-input-stream;1"].

This interface is implemented by the following components:


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.

If this is set, the file will close automatically when the end of the file is reached.
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.)


void init ( nsIFile file , PRInt32 ioFlags , PRInt32 perm , PRInt32 behaviorFlags )

void init ( nsIFile file , PRInt32 ioFlags , PRInt32 perm , PRInt32 behaviorFlags )

file: file to read from (must QI to nsILocalFile)
ioFlags: file open flags listed in prio.h
perm: file mode bits listed in prio.h
behaviorFlags: flags specifying various behaviors of the class (see enumerations in the class)

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
July 2, 2004, 3:02 am basic at mozdev dot org
valid ioflags from prio.h (NSPR)

* The file status flags.
* It is a bitwise OR of the following bit flags (only one of
* the first three flags below may be used):
* PR_RDONLY Open for reading only.
* PR_WRONLY Open for writing only.
* PR_RDWR Open for reading and writing.
* PR_CREATE_FILE If the file does not exist, the file is created
* If the file exists, this flag has no effect.
* PR_SYNC If set, each write will wait for both the file data
* and file status to be physically updated.
* PR_APPEND The file pointer is set to the end of
* the file prior to each write.
* PR_TRUNCATE If the file exists, its length is truncated to 0.
* PR_EXCL With PR_CREATE_FILE, if the file does not exist,
* the file is created. If the file already
* exists, no action and NULL is returned


#define PR_RDONLY 0x01
#define PR_WRONLY 0x02
#define PR_RDWR 0x04
#define PR_CREATE_FILE 0x08
#define PR_APPEND 0x10
#define PR_TRUNCATE 0x20
#define PR_SYNC 0x40
#define PR_EXCL 0x80

valid perms

** CAVEAT: 'mode' is currently only applicable on UNIX platforms.
** The 'mode' argument may be ignored by PR_Open on other platforms.
** 00400 Read by owner.
** 00200 Write by owner.
** 00100 Execute (search if a directory) by owner.
** 00040 Read by group.
** 00020 Write by group.
** 00010 Execute by group.
** 00004 Read by others.
** 00002 Write by others
** 00001 Execute by others.

Copyright © 1999 - 2005 XULPlanet.com