Bumping manifests a=b2g-bump
[gecko.git] / netwerk / base / public / nsIStreamTransportService.idl
blobcd39f9cba3c3bcc6f5a5dfad08d449ad71acccd0
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.
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.
18 [scriptable, uuid(5e0adf7d-9785-45c3-a193-04f25a75da8f)]
19 interface nsIStreamTransportService : nsISupports
21 /**
22 * CreateInputTransport
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.
38 * @return nsITransport instance.
40 nsITransport createInputTransport(in nsIInputStream aStream,
41 in long long aStartOffset,
42 in long long aReadLimit,
43 in boolean aCloseWhenDone);
45 /**
46 * CreateOutputTransport
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.
62 * @return nsITransport instance.
64 nsITransport createOutputTransport(in nsIOutputStream aStream,
65 in long long aStartOffset,
66 in long long aWriteLimit,
67 in boolean aCloseWhenDone);