ByteCodecs
com.typesafe.tools.mima.core.ByteCodecs$
object ByteCodecs
Helper methods to serialize a byte array as String that can be written as "modified" UTF-8 to classfiles.
Modified UTF-8 is the same as UTF-8, except for 0x00, which is represented as the "overlong" 0xC0 0x80. Constant strings in classfiles use this encoding.
Encoding (according to SID-10):
- The 8-bit bytes are split into 7-bit bytes, e.g., 0xff 0x0f becomes 0x7f 0x1f 0x00
- Every bit is incremented by 1 (modulo 0x80), in the example we get 0x00, 0x20 0x01
- 0x00 is mapped to the overlong encoding, so we get 0xC0 0x80 0x20 0x01
The +1 increment should reduce the number of (overlong) zeros in the resulting string, as 0x7f is (hoped to be) more common than 0x00.
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ByteCodecs.type