Struct xpcom::interfaces::nsIFileInputStream [] [src]

#[repr(C)]
pub struct nsIFileInputStream { /* fields omitted */ }

interface nsIFileInputStream : nsIInputStream

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

Methods

impl nsIFileInputStream
[src]

[src]

Cast this nsIFileInputStream to one of its base interfaces.

impl nsIFileInputStream
[src]

CLOSE_ON_EOF: i64 = 4
/**
     * If this is set, the file will close automatically when the end of the
     * file is reached.
     */

REOPEN_ON_REWIND: i64 = 8
/**
     * If this is set, the file will be reopened whenever we reach the start of
     * the file, either by doing a Seek(0, NS_SEEK_CUR), or by doing a relative
     * seek that happen to reach the beginning of the file. 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.)
     */

DEFER_OPEN: i64 = 16
/**
     * If this is set, the file will be opened (i.e., a call to
     * PR_Open done) only when we do an actual operation on the stream,
     * or more specifically, when one of the following is called:
     *   - Seek
     *   - Tell
     *   - SetEOF
     *   - Available
     *   - Read
     *   - ReadLine
     *
     * DEFER_OPEN is useful if we use the stream on a background
     * thread, so that the opening and possible |stat|ing of the file
     * happens there as well.
     *
     * @note Using this flag results in the file not being opened
     *       during the call to Init.  This means that any errors that might
     *       happen when this flag is not set would happen during the
     *       first read.  Also, the file is not locked when Init is called,
     *       so it might be deleted before we try to read from it.
     */

SHARE_DELETE: i64 = 32
/**
     * This flag has no effect and is totally ignored on any platform except
     * Windows since this is the default behavior on POSIX systems. On Windows
     * if this flag is set then the stream is opened in a special mode that
     * allows the OS to delete the file from disk just like POSIX.
     */

[src]

/**
     * @param file          file to read from
     * @param ioFlags       file open flags listed in prio.h (see
     *                      PR_Open documentation) or -1 to open the
     *                      file in default mode (PR_RDONLY).
     * @param perm          file mode bits listed in prio.h or -1 to
     *                      use the default value (0)
     * @param behaviorFlags flags specifying various behaviors of the class
     *        (see enumerations in the class)
     */

void init (in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags);

Methods from Deref<Target = nsIInputStream>

[src]

Cast this nsIInputStream to one of its base interfaces.

[src]

/**
 * nsIInputStream
 *
 * An interface describing a readable stream of data.  An input stream may be
 * "blocking" or "non-blocking" (see the IsNonBlocking method).  A blocking
 * input stream may suspend the calling thread in order to satisfy a call to
 * Close, Available, Read, or ReadSegments.  A non-blocking input stream, on
 * the other hand, must not block the calling thread of execution.
 *
 * NOTE: blocking input streams are often read on a background thread to avoid
 * locking up the main application thread.  For this reason, it is generally
 * the case that a blocking input stream should be implemented using thread-
 * safe AddRef and Release.
 */
/**
     * Close the stream.  This method causes subsequent calls to Read and
     * ReadSegments to return 0 bytes read to indicate end-of-file.  Any
     * subsequent calls to Available should throw NS_BASE_STREAM_CLOSED.
     */

void close ();

[src]

/**
     * Determine number of bytes available in the stream.  A non-blocking
     * stream that does not yet have any data to read should return 0 bytes
     * from this method (i.e., it must not throw the NS_BASE_STREAM_WOULD_BLOCK
     * exception).
     *
     * In addition to the number of bytes available in the stream, this method
     * also informs the caller of the current status of the stream.  A stream
     * that is closed will throw an exception when this method is called.  That
     * enables the caller to know the condition of the stream before attempting
     * to read from it.  If a stream is at end-of-file, but not closed, then
     * this method returns 0 bytes available.  (Note: some nsIInputStream
     * implementations automatically close when eof is reached; some do not).
     *
     * @return number of bytes currently available in the stream.
     *
     * @throws NS_BASE_STREAM_CLOSED if the stream is closed normally.
     * @throws <other-error> if the stream is closed due to some error
     *   condition
     */

unsigned long long available ();

[src]

/**
     * Read data from the stream.
     *
     * @param aBuf the buffer into which the data is to be read
     * @param aCount the maximum number of bytes to be read
     *
     * @return number of bytes read (may be less than aCount).
     * @return 0 if reached end-of-file
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would
     *   block the calling thread (non-blocking mode only)
     * @throws <other-error> on failure
     *
     * NOTE: this method should not throw NS_BASE_STREAM_CLOSED.
     */

[noscript] unsigned long read (in charPtr aBuf, in unsigned long aCount);

[src]

/**
     * @return true if stream is non-blocking
     *
     * NOTE: reading from a blocking input stream will block the calling thread
     * until at least one byte of data can be extracted from the stream.
     *
     * NOTE: a non-blocking input stream may implement nsIAsyncInputStream to
     * provide consumers with a way to wait for the stream to have more data
     * once its read method is unable to return any data without blocking.
     */

boolean isNonBlocking ();

Trait Implementations

impl XpCom for nsIFileInputStream
[src]

IID: nsIID = nsID(3822414368, 51180, 4563, [140, 218, 0, 96, 176, 252, 20, 163])

[src]

Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more

impl RefCounted for nsIFileInputStream
[src]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIFileInputStream
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.