Interface nsIInputStreamLengthType

Note: Instead of using these interfaces directly, consider to use InputStreamLengthHelper class.

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Returns the total length of the stream if known. Otherwise it returns -1. This is different than calling available() which returns the number of bytes ready to be read from the stream. -1 is a valid value for a stream that doesn't know its length. For instance, a pipe stream could return such value.

    It could throw NS_BASE_STREAM_WOULD_BLOCK if the inputStream is non-blocking. If this happens, you should use nsIAsyncInputStreamLength::asyncLengthWait().

    If the stream has already been read (read()/readSegments()/close()/seek() methods has been called), length() returns NS_ERROR_NOT_AVAILABLE.

    This is not an attribute because a stream can change its length. For instance, if the stream is a file inputStream and the underlying OS file changes, its length will change as well.

    Returns number

Generated using TypeDoc