Skip to content
This repository was archived by the owner on Jun 24, 2020. It is now read-only.
This repository was archived by the owner on Jun 24, 2020. It is now read-only.

Binary data #8

@sliekens

Description

@sliekens

At this time, the ITextScanner interface does not provide APIs for binary data.

The workarounds are:

  1. Use OctetLexer to read any number of bytes as instances of Element
  2. Read directly from the underlying stream

The first workaround is nasty for a number of reasons:

  • Overhead: the OctetLexer class creates an instance of the Element class for every byte.
  • Conversion: the OctetLexer class converts each byte to System.String; you have to convert it back to a byte using ITextScanner.Encoding.

The second workaround isn't much better:

  • You already have to have a reference to the underlying stream to make it work
  • Reading from the stream does not update the scanner position

Suggested fix: copy the Read and ReadByte + async variants from System.IO.Stream to the ITextScanner interface. Implement these methods in a way that updates the scanner's internal state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions