Bug 1860492 - Change file name in test @ toolkit/components/antitracking/test/browser...
[gecko.git] / xpcom / io / nsIRandomAccessStream.idl
blob20421def17e4d014784840bf551bf74a2072341e
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"
7 #include "nsISeekableStream.idl"
9 interface nsIInputStream;
10 interface nsIInterfaceRequestor;
11 interface nsIOutputStream;
13 %{C++
14 namespace mozilla::ipc {
15 class RandomAccessStreamParams;
16 } // namespace mozilla::ipc
19 native RandomAccessStreamParams(mozilla::ipc::RandomAccessStreamParams);
20 [ref] native RandomAccessStreamParamsRef(mozilla::ipc::RandomAccessStreamParams);
22 /**
23 * nsIRandomAccessStream
25 * An interface which supports both reading and writing to a storage starting
26 * at the current offset. Both the input stream and the output stream share the
27 * offset in the stream. Read operations invoked on the input stream start at
28 * the offset and advance it past the bytes read. Write operations invoked on
29 * the output stream start the offset and advance it past the bytes written.
30 * The offset can be set to an arbitrary value prior reading or writting. Each
31 * call to getInputStream or getOutputStream always returns the same object,
32 * rather than creating a new stream. It's recommended for objects implementing
33 * this interface to also implement nsIInputStream and nsIOutputStream, so they
34 * can be easilly used with e.g. NS_AsyncCopy.
36 [scriptable, builtinclass, uuid(9b5904a8-886a-420f-a1d8-847de8ffc133)]
37 interface nsIRandomAccessStream : nsISeekableStream
39 /**
40 * This method always returns the same object.
42 nsIInputStream getInputStream();
44 /**
45 * This method always returns the same object.
47 nsIOutputStream getOutputStream();
49 /**
50 * Like getInputStream but infallible.
52 [notxpcom, nostdcall] nsIInputStream inputStream();
54 /**
55 * Like getOutputStream but infallible.
57 [notxpcom, nostdcall] nsIOutputStream outputStream();
59 [notxpcom, nostdcall] RandomAccessStreamParams serialize(in nsIInterfaceRequestor aCallbacks);
61 [notxpcom, nostdcall] bool deserialize(inout RandomAccessStreamParamsRef params);