xpcom/io/nsISeekableStream.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/io/nsISeekableStream.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/*
    1.11 + * nsISeekableStream
    1.12 + *
    1.13 + * Note that a stream might not implement all methods (e.g., a readonly stream 
    1.14 + * won't implement setEOF)
    1.15 + */
    1.16 +
    1.17 +#include "nsISupports.idl"
    1.18 +
    1.19 +[scriptable, uuid(8429d350-1040-4661-8b71-f2a6ba455980)]
    1.20 +interface nsISeekableStream : nsISupports
    1.21 +{
    1.22 +    /* 
    1.23 +     * Sets the stream pointer to the value of the 'offset' parameter 
    1.24 +     */
    1.25 +    const int32_t NS_SEEK_SET = 0;
    1.26 +
    1.27 +    /*  
    1.28 +     * Sets the stream pointer to its current location plus the value 
    1.29 +     * of the offset parameter. 
    1.30 +     */
    1.31 +    const int32_t NS_SEEK_CUR = 1;
    1.32 +
    1.33 +    /* 
    1.34 +     * Sets the stream pointer to the size of the stream plus the value 
    1.35 +     * of the offset parameter. 
    1.36 +     */
    1.37 +    const int32_t NS_SEEK_END = 2;
    1.38 +
    1.39 +    /**
    1.40 +     *  seek
    1.41 +     *
    1.42 +     *  This method moves the stream offset of the steam implementing this
    1.43 +     *  interface.
    1.44 +     *
    1.45 +     *   @param whence specifies how to interpret the 'offset' parameter in
    1.46 +     *                 setting the stream offset associated with the implementing
    1.47 +     *                 stream.
    1.48 +     *     
    1.49 +     *   @param offset specifies a value, in bytes, that is used in conjunction
    1.50 +     *                 with the 'whence' parameter to set the stream offset of the 
    1.51 +     *                 implementing stream.  A negative value causes seeking in 
    1.52 +     *                 the reverse direction.
    1.53 +     *
    1.54 +     *   @throws NS_BASE_STREAM_CLOSED if called on a closed stream.
    1.55 +     */
    1.56 +    void seek(in long whence, in long long offset);
    1.57 +
    1.58 +    /**
    1.59 +     *  tell
    1.60 +     *
    1.61 +     *  This method reports the current offset, in bytes, from the start of the 
    1.62 +     *  stream. 
    1.63 +     *
    1.64 +     *   @throws NS_BASE_STREAM_CLOSED if called on a closed stream.
    1.65 +     */
    1.66 +    long long tell();
    1.67 +
    1.68 +
    1.69 +    /**
    1.70 +     *  setEOF
    1.71 +     *
    1.72 +     *  This method truncates the stream at the current offset.
    1.73 +     *
    1.74 +     *   @throws NS_BASE_STREAM_CLOSED if called on a closed stream.
    1.75 +     */
    1.76 +    void setEOF();
    1.77 +};

mercurial