Interface nsIConverterInputStreamType

A unichar input stream that wraps an input stream. This allows reading unicode strings from a stream, automatically converting the bytes from a selected character encoding.

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

  • Close the stream and free associated resources. This also closes the underlying stream, if any.

    Returns void

  • Initialize this stream.

    Parameters

    • aStream: nsIInputStream

      The underlying stream to read from.

    • aCharset: string

      The character encoding to use for converting the bytes of the stream. A null charset will be interpreted as UTF-8.

    • aBufferSize: number

      How many bytes to buffer.

    • aReplacementChar: char16_t

      The character to replace unknown byte sequences in the stream with. The standard replacement character is U+FFFD. A value of 0x0000 will cause an exception to be thrown if unknown byte sequences are encountered in the stream.

    Returns void

  • Reads into a caller-provided array.

    Returns

    The number of utf-16 code units that were successfully read. May be less than aCount, even if there is more data in the input stream. A return value of 0 means EOF.

    Note

    To read more than 2^32 code units, call this method multiple times.

    Parameters

    • aBuf: char16_t
    • aCount: number

    Returns number

  • Low-level read method that has access to the stream's underlying buffer. The writer function may be called multiple times for segmented buffers. ReadSegments is expected to keep calling the writer until either there is nothing left to read or the writer returns an error. ReadSegments should not call the writer with zero UTF-16 code units to consume.

    Returns

    number of UTF-16 code units read (may be less than aCount)

    Returns

    0 if reached end of file (or if aWriter refused to consume data)

    Throws

    NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would block the calling thread (non-blocking mode only)

    Throws

    on failure

    NOTE: this function may be unimplemented if a stream has no underlying buffer

    Parameters

    • aWriter: nsWriteUnicharSegmentFun

      the "consumer" of the data to be read

    • aClosure: voidPtr

      opaque parameter passed to writer

    • aCount: number

      the maximum number of UTF-16 code units to be read

    Returns number

  • Read into a string object.

    Returns

    The number of UTF-16 code units that were read.

    Parameters

    • aCount: number

      The number of UTF-16 code units that should be read

    • aString: string

    Returns number

Generated using TypeDoc