Abstract class for encoding and decoding values of type A to and from TOON formats. Encapsulates logic to map TOON representations into native type structures and vice versa, handling serialization and deserialization as per TOON encoding standards using UTF-8 character set.
This class requires an implementation for two core operations: decoding a value of type A from a TOON representation and encoding a value of type A into a TOON representation.
Attributes
- Companion
- object
- Source
- ToonCodec.scala
- Graph
-
- Supertypes
Members list
Value members
Abstract methods
Attempts to decode a value of type A from the specified ToonReader, but may fail with ToonCodecError error if the TOON input does not encode a value of this type.
Attempts to decode a value of type A from the specified ToonReader, but may fail with ToonCodecError error if the TOON input does not encode a value of this type.
Value parameters
- in
-
an instance of
ToonReaderthat provides access to the TOON input to parse a TOON value to value of typeA
Attributes
- Source
- ToonCodec.scala
Encodes the specified value using provided ToonWriter, but may fail with ToonCodecError if it cannot be encoded properly according to TOON specification requirements.
Encodes the specified value using provided ToonWriter, but may fail with ToonCodecError if it cannot be encoded properly according to TOON specification requirements.
Value parameters
- out
-
an instance of
ToonWriterthat provides access to TOON output to serialize the specified value as a TOON value - x
-
the value provided for serialization
Attributes
- Source
- ToonCodec.scala
Concrete methods
Decodes a value of type A from the specified ByteBuffer using the default configuration.
Decodes a value of type A from the specified ByteBuffer using the default configuration.
Value parameters
- input
-
the byte buffer containing TOON input
Attributes
- Returns
-
Eitherwhere theLeftcontains aSchemaErrorif decoding fails, or theRightcontains the successfully decoded value of typeA - Definition Classes
- Source
- ToonCodec.scala
Decodes a value of type A from the specified ByteBuffer using the provided configuration.
Decodes a value of type A from the specified ByteBuffer using the provided configuration.
Value parameters
- config
-
the reader configuration to use for parsing
- input
-
the byte buffer containing TOON input
Attributes
- Returns
-
Eitherwhere theLeftcontains aSchemaErrorif decoding fails, or theRightcontains the successfully decoded value of typeA - Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Decodes an inline array from comma-separated string values. Used for TOON's compact inline array format: xs[3]: 1,2,3
Decodes an inline array from comma-separated string values. Used for TOON's compact inline array format: xs[3]: 1,2,3
Value parameters
- expectedLength
-
the expected length from the array header
- values
-
array of string values parsed from the inline array
Attributes
- Source
- ToonCodec.scala
Attempts to decode a value of type A from the specified ToonReader, but may fail with ToonCodecError error if the TOON input is not a key or does not encode a value of this type.
Attempts to decode a value of type A from the specified ToonReader, but may fail with ToonCodecError error if the TOON input is not a key or does not encode a value of this type.
Value parameters
- in
-
an instance of
ToonReaderthat provides access to the TOON input to parse a TOON key to value of typeA
Attributes
- Source
- ToonCodec.scala
Decodes a list-format array where each item is prefixed with -. Used for non-uniform objects or complex nested structures.
Decodes a list-format array where each item is prefixed with -. Used for non-uniform objects or complex nested structures.
Value parameters
- expectedLength
-
the expected number of items from the array header
- in
-
the ToonReader positioned at the first list item line
Attributes
- Source
- ToonCodec.scala
Decodes a tabular array from field-value row data. Used for TOON's tabular format: items[2]{sku,qty,price}: followed by rows.
Decodes a tabular array from field-value row data. Used for TOON's tabular format: items[2]{sku,qty,price}: followed by rows.
Value parameters
- delimiter
-
the delimiter to use for splitting rows
- expectedLength
-
the expected number of rows
- fieldNames
-
the field names from the header
- in
-
the ToonReader positioned after the header line
Attributes
- Source
- ToonCodec.scala
Decodes a single tabular row into a record value. Used when this codec's type is an element in a tabular array.
Decodes a single tabular row into a record value. Used when this codec's type is an element in a tabular array.
Value parameters
- fieldNames
-
the field names from the tabular header
- values
-
the values parsed from the row (one per field)
Attributes
- Source
- ToonCodec.scala
Encodes the specified value to the given ByteBuffer using the default configuration.
Encodes the specified value to the given ByteBuffer using the default configuration.
Value parameters
- output
-
the byte buffer to write TOON output to
- value
-
the value to encode
Attributes
- Definition Classes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Encodes the specified value as a field within a TOON record.
Encodes the specified value as a field within a TOON record.
Value parameters
- fieldName
-
the name of the field
- out
-
an instance of
ToonWriterthat provides access to TOON output - x
-
the value provided for serialization
Attributes
- Source
- ToonCodec.scala
Encodes the specified value using provided ToonWriter as a TOON key, but may fail with ToonCodecError if it cannot be encoded properly according to TOON specification requirements.
Encodes the specified value using provided ToonWriter as a TOON key, but may fail with ToonCodecError if it cannot be encoded properly according to TOON specification requirements.
Value parameters
- out
-
an instance of
ToonWriterthat provides access to TOON output to serialize the specified value as a TOON key - x
-
the value provided for serialization
Attributes
- Source
- ToonCodec.scala
Encodes a value as a single row in tabular format (values only, no keys). Used when this codec's values are elements in a tabular array.
Encodes a value as a single row in tabular format (values only, no keys). Used when this codec's values are elements in a tabular array.
Value parameters
- delimiter
-
the delimiter to use between values
- out
-
the writer to output to
- x
-
the value to encode
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala
Attributes
- Source
- ToonCodec.scala