mimekit-ts - v1.0.0
    Preparing search index...

    Class ChainedStream

    A chained stream.

    Chains multiple streams together such that reading or writing beyond the end of one stream spills over into the next stream in the chain, making the chain appear as one continuous stream.

    Hierarchy (View Summary)

    Index
    • get canRead(): boolean

      Whether the chained stream supports reading.

      The chained stream only supports reading if all of its streams support it.

      Returns boolean

    • get canWrite(): boolean

      Whether the chained stream supports writing.

      The chained stream only supports writing if all of its streams support it.

      Returns boolean

    • get canSeek(): boolean

      Whether the chained stream supports seeking.

      The chained stream only supports seeking if all of its streams support it.

      Returns boolean

    • get length(): number

      The combined length, in bytes, of all chained streams.

      Returns number

    • get position(): number

      The current position within the chained stream.

      Getting the position is always possible, but setting the position requires all streams to be seekable.

      Returns number

    • set position(value: number): void

      Set the current position within the chained stream.

      Parameters

      • value: number

      Returns void

    • Validate buffer, offset, and count arguments for stream read/write operations.

      Parameters

      • buffer: Uint8Array

        The buffer supplied by the caller.

      • offset: number

        The starting offset in the buffer.

      • count: number

        The number of bytes to read or write.

      Returns void

      offset or count does not specify a valid range in buffer.

    • Add a stream to the end of the chain.

      Parameters

      • stream: Stream

        The stream.

      • leaveOpen: boolean = false

        Whether the stream should remain open after the chained stream is disposed.

      Returns void

      stream is not a stream.

    • Read bytes from the chained stream.

      If the current child stream does not have enough remaining data to complete the read, the read progresses into the next stream in the chain.

      Parameters

      • buffer: Uint8Array

        The buffer to read data into.

      • offset: number

        The offset into the buffer to start reading data.

      • count: number

        The number of bytes to read.

      Returns number

      The total number of bytes read into the buffer, or zero if the end of the stream has been reached.

    • Write bytes to the chained stream.

      If the current child stream does not have enough remaining space before the next stream boundary, the write progresses into the next stream in the chain.

      Parameters

      • buffer: Uint8Array

        The buffer to write.

      • offset: number

        The offset of the first byte to write.

      • count: number

        The number of bytes to write.

      Returns void

    • Set the position within the chained stream.

      Parameters

      • offset: number

        The offset relative to origin.

      • origin: SeekOrigin

        The reference point used to obtain the new position.

      Returns number

      The new position within the chained stream.

    • Setting the length of a chained stream is not supported.

      Parameters

      • _value: number

        The requested length.

      Returns void

      Always thrown because the operation is unsupported.

    • Copy data from this stream to another stream.

      Parameters

      • destination: Stream

        The stream that will receive the copied data.

      • bufferSize: number = 4096

        The temporary buffer size to use while copying.

      Returns void

    • Throw for an unsupported stream operation.

      Parameters

      • operation: string

        The unsupported operation name.

      Returns never

      Always thrown because the operation is unsupported.