PdfContentLexer class

Content stream tokenizer.

Recognizes numbers, names, literal and hexadecimal strings with escapes, arrays, dictionaries, comments and keywords. It does not interpret BI … ID … EI: the binary data of an inline image is the parser's responsibility, and the parser uses position to consume the raw bytes directly.

The lexer is tolerant: unexpected bytes never throw, they become single-character keywords. A real content stream nearly always has some garbage in it, and aborting the whole read because of that would be worse than ignoring it.

Constructors

PdfContentLexer(Uint8List data, {int start = 0, int? end})
Creates a lexer over data, optionally limited to start .. end.

Properties

data → Uint8List
Source bytes.
final
end → int
Index just past the last byte considered.
final
hashCode → int
The hash code for this object.
no setterinherited
position ↔ int
Current read position.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

next() → PdfContentToken
Reads the next token.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
skipWhitespace() → void
Skips over whitespace.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

isDelimiter(int byte) → bool
True for the PDF delimiters.
isTokenBoundary(int byte) → bool
True when the byte ends a regular token.
isWhitespace(int byte) → bool
True for the six PDF whitespace bytes.
parseNumber(String text) → double
Converts the lexeme of a number, tolerating the forms real producers emit: 4., .5, --3, 6.-2, 1e3.