Package swim.codec
swim.codec
enables efficient, interruptible transcoding of network protocols and data
formats, without blocking or intermediate buffering.
Inputs and Outputs
An Input reader abstracts over a non-blocking token input stream,
with single token lookahead. An Output writer abstracts over a
non-blocking token output stream.
Parsers and Writers
A Parser incrementally reads from a sequence of Input
chunks to produce a parsed result. A Writer incrementally writes
to a sequence of Output chunks.
Decoders and Encoders
A Decoder incrementally decodes a sequence of input buffers to produce a decoded result. An Encoder
incrementally encodes a value into a sequence of output
buffers.
Binary codecs
The Binary factory has methods to create Input readers
that read bytes out of byte buffers, and methods to create Output
writers that write bytes into byte buffers.
Text codecs
The Unicode factory has methods to create Input readers
that read Unicode code points out of strings, and methods to create Output writers that write Unicode code points into strings.
The Utf8 factory has methods to create Input readers
that decode Unicode code points out of UTF-8 encoded byte buffers, and
methods to create Output writers that encode Unicode code points
into UTF-8 encoded byte buffers.
Binary-Text codecs
The Base10 factory has methods to create Parsers that
incrementally parse decimal formatted integers, and methods to create Writers that incrementally write decimal formatted integers.
The Base16 factory has methods to create Parsers that
incrementally decode hexadecimal encoded text input into byte buffers, and
methods to create Writers that incrementally encode byte buffers to
hexadecimal encoded text output.
The Base64 factory has methods to create Parsers that
incrementally decode base-64 encoded text input into byte buffers, and
methods to create Writers that incrementally encode byte buffers to
base-64 encoded text output.
Formatters
The Display interface provides a standard way for implementing
classes to directly output human readable display strings. Similarly, the
Debug interface provides a standard way for implementing classes to
directly output developer readable debug strings.
Format provides extension methods to output display and debug
strings for all types, including builtin Java types. OutputStyle
provides helper functions to conditionally emit ASCII escape codes to
stylize text for console output.
Diagnostics
A Tag abstracts over a source input location. A Mark
describes a source input position, and a Span describes a source
input range. A Diagnostic attaches an informational message to a
source input location, and supports displaying the diagnostic as an
annotated snippet of the relevant source input.
-
Interface Summary Interface Description Debug Type that can output a developer readable debug string.Display Type that can output a human readable display string. -
Class Summary Class Description Base10 Base16 Base64 Binary Decoder<O> Continuation of how to decode subsequent input buffers from a byte stream.Detect Diagnostic Informational message attached to an input location.DynamicDecoder<O> Dynamically generatedDecodercontinuation.DynamicEncoder<I,O> Dynamically generatedEncodercontinuation.Encoder<I,O> Continuation of how encode subsequent output buffers for a byte stream.Format Text format utility functions.Input Non-blocking token stream reader, with single token lookahead.InputBuffer Non-blocking token stream buffer.InputSettings Inputconsumption parameters.Mark Description of a source position, identified by byte offset, line, and column number, with an optional note.Output<T> Non-blocking token stream writer.OutputBuffer<T> Non-blocking token stream buffer.OutputSettings Outputproduction parameters.OutputStyle Stylized text output utility functions.Parser<O> Continuation of how to parse subsequentInputtokens from a stream.Span Description of a source range, identified by a closed interval between start and endmarks.Tag Description of a source location.Unicode Utf8 UtfErrorMode Unicode transformation format error handling mode.Writer<I,O> Continuation of how to write subsequentOutputtokens to a stream. -
Exception Summary Exception Description DecoderException Thrown when aDecoderdecodes invalid data.EncoderException Thrown when anEncoderencodes invalid data.InputException Thrown when reading invalidInput.OutputException Thrown when writing invalidOutput.ParserException Thrown when aParserparses invdalid syntax.WriterException Thrown when aWriterattempts to write invalid syntax.