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