xpcom/io/nsISafeOutputStream.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsISupports.idl"
     8 /**
     9  * This interface provides a mechanism to control an output stream
    10  * that takes care not to overwrite an existing target until it is known
    11  * that all writes to the destination succeeded.
    12  * 
    13  * An object that supports this interface is intended to also support
    14  * nsIOutputStream.
    15  *
    16  * For example, a file output stream that supports this interface writes to
    17  * a temporary file, and moves it over the original file when |finish| is
    18  * called only if the stream can be successfully closed and all writes
    19  * succeeded.  If |finish| is called but something went wrong during
    20  * writing, it will delete the temporary file and not touch the original.
    21  * If the stream is closed by calling |close| directly, or the stream
    22  * goes away, the original file will not be overwritten, and the temporary
    23  * file will be deleted.
    24  *
    25  * Currently, this interface is implemented only for file output streams.
    26  */
    27 [scriptable, uuid(5f914307-5c34-4e1f-8e32-ec749d25b27a)]
    28 interface nsISafeOutputStream : nsISupports
    29 {
    30     /**
    31      * Call this method to close the stream and cause the original target
    32      * to be overwritten. Note: if any call to |write| failed to write out
    33      * all of the data given to it, then calling this method will |close| the
    34      * stream and return failure. Further, if closing the stream fails, this
    35      * method will return failure. The original target will be overwritten only
    36      * if all calls to |write| succeeded and the stream was successfully closed.
    37      */
    38     void finish();
    39 };

mercurial