Create a Codec for an enumeration type that can correctly represent its value
Create a Codec for an enumeration type that can correctly represent its value
The inferred type
the enumeration type to create a codec for
the Codec used for actually representing the value
Generated codec
Same as createEnumerationCodec but with a Codec type of Long
Same as createEnumerationCodec but with a Codec type of Long
NOTE: enumerations in scala can't be represented by more than an Int anyways, so this conversion shouldnt matter. This is only to overload createEnumerationCodec to work with uint32[L] codecs (which are Long)
Used in certain instances where Codec defintions are stubbed out
Codec for how PlanetSide represents strings on the wire
Same as encodedString but with a bit adjustment
Same as encodedString but with a bit adjustment
This comes in handy when a PlanetSide string is decoded on a non-byte boundary. The PlanetSide client will byte align after decoding the string lenght, but BEFORE the string itself. Scodec doesn't like this variability and there doesn't appear to be a way to fix this issue.
The adjustment amount in bits
Generated string decoding codec with adjustment
Common codec for how PlanetSide stores string sizes
Common codec for how PlanetSide stores string sizes
When the first bit of the byte is set, the size can be between [0, 127]. Otherwise, it is between [128, 32767] and two bytes are used for encoding. The magic in this is next level (read as: SCodec makes things hard to understand)
Common codec for PlanetSide wchar_t strings (wide strings, UTF-16)
Common codec for PlanetSide wchar_t strings (wide strings, UTF-16)
An encoded *wide* string is twice the length of the given encoded size and half of the length of the input string. We use xmap to transform the encodedString codec as this change is just a division and multiply
Same as encodedWideString but with a bit alignment after the decoded size
Encode and decode a byte-aligned List
.
This function is copied almost verbatim from its source, with exception of swapping the normal ListCodec
for a new AlignedListCodec
.
Encode and decode a byte-aligned List
.
This function is copied almost verbatim from its source, with exception of swapping the normal ListCodec
for a new AlignedListCodec
.
the type of the List
contents
the codec that represents the prefixed size of the List
the number of bits padded between the List
size and the List
contents
a codec that describes each of the contents of the List
a codec that works on a List of A
codec\package.scala, listOfN
Codec that encodes/decodes a list of n
elements, where n
is known at compile time.
This function is copied almost verbatim from its source, with exception of swapping the parameter that is normally a Nat
literal
.
Codec that encodes/decodes a list of n
elements, where n
is known at compile time.
This function is copied almost verbatim from its source, with exception of swapping the parameter that is normally a Nat
literal
.
The modified function takes a normal unsigned Integer
and assures that the parameter is non-negative before further processing.
the type of the List
contents
the known size of the List
a codec that describes each of the contents of the List
a codec that works on a List of A but excludes the size from the encoding
codec\package.scala, provides
codec\package.scala, listOfN
codec\package.scala, sizedList
A peek
that decodes like the normal but encodes nothing.
A peek
that decodes like the normal but encodes nothing.
Decoding Codec[A]
from the input vector emits a value but reverts to the prior read position.
Encoding Codec[A]
to the input vector appends no new data to the input vector.
In effect, peek
is a harmless meta-Codec
that processes a value and introduces no changes to the input/output vector.
codec that decodes the value
Codec
that behaves the same as target
but resets the contents of the vector as if Codec
were never applied
scodec.codecs.peek
or codecs/package.scala:peek
Variable for the charset that PlanetSide uses for unicode (2 byte unicode)