open static method

CosDocument open(
  1. Uint8List bytes, {
  2. String password = '',
  3. List<int>? populatedRanges,
})

Opens a document. For encrypted files password is tried first as the user and then as the owner password; the default empty password is what most "owner-locked" business documents expect. Throws CosPasswordException when it opens neither.

When the cross-reference machinery is broken (missing startxref, corrupt offsets, truncated tables), falls back to rebuilding the xref by scanning the file for object headers - see _recover. populatedRanges declares which parts of bytes were actually read, for the sparse buffer a ranged/progressive open assembles (see _populated). Flattened, sorted, non-overlapping [start, end) pairs in buffer coordinates. Null - the default, and every whole-file open - means the buffer is complete.

Implementation

static CosDocument open(Uint8List bytes,
        {String password = '', List<int>? populatedRanges}) =>
    _open(bytes, password, populatedRanges, null);