netwerk/base/public/nsIStreamTransportService.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #include "nsISupports.idl"
     7 interface nsITransport;
     8 interface nsIInputStream;
     9 interface nsIOutputStream;
    11 /**
    12  * This service read/writes a stream on a background thread.
    13  *
    14  * Use this service to transform any blocking stream (e.g., file stream)
    15  * into a fully asynchronous stream that can be read/written without 
    16  * blocking the main thread.
    17  */
    18 [scriptable, uuid(5e0adf7d-9785-45c3-a193-04f25a75da8f)]
    19 interface nsIStreamTransportService : nsISupports
    20 {
    21     /**
    22      * CreateInputTransport
    23      *
    24      * @param aStream
    25      *        The input stream that will be read on a background thread.
    26      *        This stream must implement "blocking" stream semantics.
    27      * @param aStartOffset
    28      *        The input stream will be read starting from this offset.  Pass
    29      *        -1 to read from the current stream offset.  NOTE: this parameter
    30      *        is ignored if the stream does not support nsISeekableStream.
    31      * @param aReadLimit
    32      *        This parameter limits the number of bytes that will be read from
    33      *        the input stream.  Pass -1 to read everything.
    34      * @param aCloseWhenDone
    35      *        Specify this flag to have the input stream closed once its
    36      *        contents have been completely read.
    37      *
    38      * @return nsITransport instance.
    39      */
    40     nsITransport createInputTransport(in nsIInputStream aStream,
    41                                       in long long aStartOffset,
    42                                       in long long aReadLimit,
    43                                       in boolean aCloseWhenDone);
    45     /**
    46      * CreateOutputTransport
    47      *
    48      * @param aStream
    49      *        The output stream that will be written to on a background thread.
    50      *        This stream must implement "blocking" stream semantics.
    51      * @param aStartOffset
    52      *        The output stream will be written starting at this offset.  Pass
    53      *        -1 to write to the current stream offset.  NOTE: this parameter
    54      *        is ignored if the stream does not support nsISeekableStream.
    55      * @param aWriteLimit
    56      *        This parameter limits the number of bytes that will be written to
    57      *        the output stream.  Pass -1 for unlimited writing.
    58      * @param aCloseWhenDone
    59      *        Specify this flag to have the output stream closed once its
    60      *        contents have been completely written.
    61      *
    62      * @return nsITransport instance.
    63      */
    64     nsITransport createOutputTransport(in nsIOutputStream aStream,
    65                                        in long long aStartOffset,
    66                                        in long long aWriteLimit,
    67                                        in boolean aCloseWhenDone);
    68 };

mercurial