Struct xpcom::interfaces::nsIFileOutputStream [] [src]

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

interface nsIFileOutputStream : nsIOutputStream

/**
 * An output stream that lets you stream to a file.
 */

Methods

impl nsIFileOutputStream
[src]

[src]

Cast this nsIFileOutputStream to one of its base interfaces.

impl nsIFileOutputStream
[src]

DEFER_OPEN: i64 = 1
/**
     * See the same constant in nsIFileInputStream. The deferred open will
     * be performed when one of the following is called:
     *   - Seek
     *   - Tell
     *   - SetEOF
     *   - Write
     *   - Flush
     *
     * @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 write, and if the file is to be created, then it will not
     *       appear on the disk until the first write.
     */

[src]

/**
     * @param file          file to write to
     * @param ioFlags       file open flags listed in prio.h (see
     *                      PR_Open documentation) or -1 to open the
     *                      file in default mode (PR_WRONLY |
     *                      PR_CREATE_FILE | PR_TRUNCATE)
     * @param perm          file mode bits listed in prio.h or -1 to
     *                      use the default permissions (0664)
     * @param behaviorFlags flags specifying various behaviors of the class
     *        (currently none supported)
     */

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

[src]

/**
     * @param length        asks the operating system to allocate storage for
     *                      this file of at least |length| bytes long, and
     *                      set the file length to the corresponding size.
     * @throws NS_ERROR_FAILURE if the preallocation fails.
     * @throws NS_ERROR_NOT_INITIALIZED if the file is not opened.
     */

[noscript] void preallocate (in long long length);

Methods from Deref<Target = nsIOutputStream>

[src]

Cast this nsIOutputStream to one of its base interfaces.

[src]

/**
 * nsIOutputStream
 *
 * An interface describing a writable stream of data.  An output stream may be
 * "blocking" or "non-blocking" (see the IsNonBlocking method).  A blocking
 * output stream may suspend the calling thread in order to satisfy a call to
 * Close, Flush, Write, WriteFrom, or WriteSegments.  A non-blocking output
 * stream, on the other hand, must not block the calling thread of execution.
 *
 * NOTE: blocking output streams are often written to on a background thread to
 * avoid locking up the main application thread.  For this reason, it is
 * generally the case that a blocking output stream should be implemented using
 * thread- safe AddRef and Release.
 */
/**
     * Close the stream. Forces the output stream to flush any buffered data.
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
     *   the calling thread (non-blocking mode only)
     */

void close ();

[src]

/**
     * Flush the stream.
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
     *   the calling thread (non-blocking mode only)
     */

void flush ();

[src]

/**
     * Write data into the stream.
     *
     * @param aBuf the buffer containing the data to be written
     * @param aCount the maximum number of bytes to be written
     *
     * @return number of bytes written (may be less than aCount)
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
     *   block the calling thread (non-blocking mode only)
     * @throws <other-error> on failure
     */

unsigned long write (in string aBuf, in unsigned long aCount);

[src]

/**
     * Writes data into the stream from an input stream.
     *
     * @param aFromStream the stream containing the data to be written
     * @param aCount the maximum number of bytes to be written
     *
     * @return number of bytes written (may be less than aCount)
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
     *    block the calling thread (non-blocking mode only). This failure
     *    means no bytes were transferred.
     * @throws <other-error> on failure
     *
     * NOTE: This method is defined by this interface in order to allow the
     * output stream to efficiently copy the data from the input stream into
     * its internal buffer (if any). If this method was provided as an external
     * facility, a separate char* buffer would need to be used in order to call
     * the output stream's other Write method.
     */

unsigned long writeFrom (in nsIInputStream aFromStream, in unsigned long aCount);

[src]

/**
     * @return true if stream is non-blocking
     *
     * NOTE: writing to a blocking output stream will block the calling thread
     * until all given data can be consumed by the stream.
     *
     * NOTE: a non-blocking output stream may implement nsIAsyncOutputStream to
     * provide consumers with a way to wait for the stream to accept more data
     * once its write method is unable to accept any data without blocking.
     */

boolean isNonBlocking ();

Trait Implementations

impl XpCom for nsIFileOutputStream
[src]

IID: nsIID = nsID(3878996681, 4757, 20079, [150, 132, 58, 196, 225, 249, 16, 99])

[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 nsIFileOutputStream
[src]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIFileOutputStream
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.