michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /* michael@0: * nsISeekableStream michael@0: * michael@0: * Note that a stream might not implement all methods (e.g., a readonly stream michael@0: * won't implement setEOF) michael@0: */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(8429d350-1040-4661-8b71-f2a6ba455980)] michael@0: interface nsISeekableStream : nsISupports michael@0: { michael@0: /* michael@0: * Sets the stream pointer to the value of the 'offset' parameter michael@0: */ michael@0: const int32_t NS_SEEK_SET = 0; michael@0: michael@0: /* michael@0: * Sets the stream pointer to its current location plus the value michael@0: * of the offset parameter. michael@0: */ michael@0: const int32_t NS_SEEK_CUR = 1; michael@0: michael@0: /* michael@0: * Sets the stream pointer to the size of the stream plus the value michael@0: * of the offset parameter. michael@0: */ michael@0: const int32_t NS_SEEK_END = 2; michael@0: michael@0: /** michael@0: * seek michael@0: * michael@0: * This method moves the stream offset of the steam implementing this michael@0: * interface. michael@0: * michael@0: * @param whence specifies how to interpret the 'offset' parameter in michael@0: * setting the stream offset associated with the implementing michael@0: * stream. michael@0: * michael@0: * @param offset specifies a value, in bytes, that is used in conjunction michael@0: * with the 'whence' parameter to set the stream offset of the michael@0: * implementing stream. A negative value causes seeking in michael@0: * the reverse direction. michael@0: * michael@0: * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. michael@0: */ michael@0: void seek(in long whence, in long long offset); michael@0: michael@0: /** michael@0: * tell michael@0: * michael@0: * This method reports the current offset, in bytes, from the start of the michael@0: * stream. michael@0: * michael@0: * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. michael@0: */ michael@0: long long tell(); michael@0: michael@0: michael@0: /** michael@0: * setEOF michael@0: * michael@0: * This method truncates the stream at the current offset. michael@0: * michael@0: * @throws NS_BASE_STREAM_CLOSED if called on a closed stream. michael@0: */ michael@0: void setEOF(); michael@0: };