c0data
    Preparing search index...

    Class StreamReader

    Scans a buffer for commits. An unescaped ETB is always a commit, even inside open text or a level. A committed block that is not well-formed, cut by its ETB or holding any other error, is damaged: nothing in it is delivered, and by default the reader delivers the records before it and then throws DamagedBlockError; with continuePastDamage it reads on past the block. The tail after the last commit is torn unless it holds only layout, notes or EOT. A SYN inside the stream tears the uncommitted bytes before it (tornRegions): they belong to no block and deliver nothing, and a new document begins at the SYN.

    Index
    blocks: [number, number][] = []

    [start, end) of each committed block (ETB excluded).

    buf: Uint8Array
    continuePastDamage: boolean
    damaged: number[] = []

    Indexes of damaged blocks.

    torn: boolean
    tornRegions: [number, number][] = []

    [start, end) of each region torn by a mid-stream SYN: the bytes between a commit (or the start) and the SYN, when they hold more than layout, notes or EOT. torn reports only the tail after the last commit.

    • get committedEnd(): number

      Offset just past the last ETB and its payload.

      Returns number

    • get container(): Container

      The committed region as documents, damaged blocks left out. Throws DamagedBlockError when a block is damaged, unless continuing.

      Returns Container

    • Parameters

      • i: number

      Returns Uint8Array

    • Offset after a block's ETB and payload: the start of the next block.

      Parameters

      • i: number

      Returns number

    • Parameters

      • cb: (block: Uint8Array, i: number) => void

      Returns void

    • Every committed record in order, up to the first damaged block; then DamagedBlockError, unless continuing, in which case every record of every sound block.

      Parameters

      Returns void

    • Parameters

      • i: number

      Returns boolean