|
1 /* -*- Mode: C++; tab-width: 4; 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/. */ |
|
5 |
|
6 |
|
7 /* |
|
8 * nsISeekableStream |
|
9 * |
|
10 * Note that a stream might not implement all methods (e.g., a readonly stream |
|
11 * won't implement setEOF) |
|
12 */ |
|
13 |
|
14 #include "nsISupports.idl" |
|
15 |
|
16 [scriptable, uuid(8429d350-1040-4661-8b71-f2a6ba455980)] |
|
17 interface nsISeekableStream : nsISupports |
|
18 { |
|
19 /* |
|
20 * Sets the stream pointer to the value of the 'offset' parameter |
|
21 */ |
|
22 const int32_t NS_SEEK_SET = 0; |
|
23 |
|
24 /* |
|
25 * Sets the stream pointer to its current location plus the value |
|
26 * of the offset parameter. |
|
27 */ |
|
28 const int32_t NS_SEEK_CUR = 1; |
|
29 |
|
30 /* |
|
31 * Sets the stream pointer to the size of the stream plus the value |
|
32 * of the offset parameter. |
|
33 */ |
|
34 const int32_t NS_SEEK_END = 2; |
|
35 |
|
36 /** |
|
37 * seek |
|
38 * |
|
39 * This method moves the stream offset of the steam implementing this |
|
40 * interface. |
|
41 * |
|
42 * @param whence specifies how to interpret the 'offset' parameter in |
|
43 * setting the stream offset associated with the implementing |
|
44 * stream. |
|
45 * |
|
46 * @param offset specifies a value, in bytes, that is used in conjunction |
|
47 * with the 'whence' parameter to set the stream offset of the |
|
48 * implementing stream. A negative value causes seeking in |
|
49 * the reverse direction. |
|
50 * |
|
51 * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. |
|
52 */ |
|
53 void seek(in long whence, in long long offset); |
|
54 |
|
55 /** |
|
56 * tell |
|
57 * |
|
58 * This method reports the current offset, in bytes, from the start of the |
|
59 * stream. |
|
60 * |
|
61 * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. |
|
62 */ |
|
63 long long tell(); |
|
64 |
|
65 |
|
66 /** |
|
67 * setEOF |
|
68 * |
|
69 * This method truncates the stream at the current offset. |
|
70 * |
|
71 * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. |
|
72 */ |
|
73 void setEOF(); |
|
74 }; |