netwerk/base/public/nsIStreamTransportService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIStreamTransportService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsITransport;
    1.11 +interface nsIInputStream;
    1.12 +interface nsIOutputStream;
    1.13 +
    1.14 +/**
    1.15 + * This service read/writes a stream on a background thread.
    1.16 + *
    1.17 + * Use this service to transform any blocking stream (e.g., file stream)
    1.18 + * into a fully asynchronous stream that can be read/written without 
    1.19 + * blocking the main thread.
    1.20 + */
    1.21 +[scriptable, uuid(5e0adf7d-9785-45c3-a193-04f25a75da8f)]
    1.22 +interface nsIStreamTransportService : nsISupports
    1.23 +{
    1.24 +    /**
    1.25 +     * CreateInputTransport
    1.26 +     *
    1.27 +     * @param aStream
    1.28 +     *        The input stream that will be read on a background thread.
    1.29 +     *        This stream must implement "blocking" stream semantics.
    1.30 +     * @param aStartOffset
    1.31 +     *        The input stream will be read starting from this offset.  Pass
    1.32 +     *        -1 to read from the current stream offset.  NOTE: this parameter
    1.33 +     *        is ignored if the stream does not support nsISeekableStream.
    1.34 +     * @param aReadLimit
    1.35 +     *        This parameter limits the number of bytes that will be read from
    1.36 +     *        the input stream.  Pass -1 to read everything.
    1.37 +     * @param aCloseWhenDone
    1.38 +     *        Specify this flag to have the input stream closed once its
    1.39 +     *        contents have been completely read.
    1.40 +     *
    1.41 +     * @return nsITransport instance.
    1.42 +     */
    1.43 +    nsITransport createInputTransport(in nsIInputStream aStream,
    1.44 +                                      in long long aStartOffset,
    1.45 +                                      in long long aReadLimit,
    1.46 +                                      in boolean aCloseWhenDone);
    1.47 +
    1.48 +    /**
    1.49 +     * CreateOutputTransport
    1.50 +     *
    1.51 +     * @param aStream
    1.52 +     *        The output stream that will be written to on a background thread.
    1.53 +     *        This stream must implement "blocking" stream semantics.
    1.54 +     * @param aStartOffset
    1.55 +     *        The output stream will be written starting at this offset.  Pass
    1.56 +     *        -1 to write to the current stream offset.  NOTE: this parameter
    1.57 +     *        is ignored if the stream does not support nsISeekableStream.
    1.58 +     * @param aWriteLimit
    1.59 +     *        This parameter limits the number of bytes that will be written to
    1.60 +     *        the output stream.  Pass -1 for unlimited writing.
    1.61 +     * @param aCloseWhenDone
    1.62 +     *        Specify this flag to have the output stream closed once its
    1.63 +     *        contents have been completely written.
    1.64 +     *
    1.65 +     * @return nsITransport instance.
    1.66 +     */
    1.67 +    nsITransport createOutputTransport(in nsIOutputStream aStream,
    1.68 +                                       in long long aStartOffset,
    1.69 +                                       in long long aWriteLimit,
    1.70 +                                       in boolean aCloseWhenDone);
    1.71 +};

mercurial