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

    Class RandomAccessStream

    A read-only, seekable stream over a SyncRandomAccessReader, backed by a fixed-size chunk cache.

    Hierarchy (View Summary)

    Index
    • Create a stream over a window of a random-access reader.

      Parameters

      • reader: SyncRandomAccessReader

        The synchronous source to read from.

      • start: number = 0

        Byte offset in reader where this stream begins.

      • Optionallength: number

        Length of the window in bytes; defaults to the remainder of the reader from start.

      • chunkSize: number = DEFAULT_CHUNK_SIZE

        Size of the read-ahead cache in bytes.

      Returns RandomAccessStream

      start, length, or chunkSize is out of range.

    • get position(): number

      The current position within the stream.

      Returns number

    • set position(value: number): void

      Set the current position within the stream.

      Parameters

      • value: number

      Returns void

    • Read bytes from the stream.

      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 stream. Not supported.

      Parameters

      • _buffer: Uint8Array
      • _offset: number
      • _count: number

      Returns void

    • Set the position within the 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 stream.

    • 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

    • 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.

    • Throw for an unsupported stream operation.

      Parameters

      • operation: string

        The unsupported operation name.

      Returns never

      Always thrown because the operation is unsupported.