class StringKeyCodec extends DataCodec
Intended for Legacy support only!
This should only be used where compatibility with StringKeyFormat is required, for all other
uses, please see the more flexible InlineStringCodec.
Provides a codec for Pegasus data that is compatible with StringKeyFormat.
While this codec encodes data in the same format as StringKeyFormat, it is
designed to be used with Courier, not with Play JSON Formats.
Limitations:
- The pegasus bytes type is not supported, consider base64 encoding to a string instead
- The pegasus union type is not supported, please migrate to InlineStringCodec if needed
- The pegasus map type is not supported, please migrate to InlineStringCodec if needed
- Records containing optional fields are not allowed
This codec is "schema aided", meaning that the correct Pegasus schema is required to serialize
or deserialize data, even to the raw DataMap and DataList types. This is because
the order and names of record fields, defined in the schema, must be used by the codec to
correctly serialize/deserialize to StringKeyFormat tuples.
The important type relations are:
StringKeyFormat type | Pegasus raw type | Pegasus schema type | Scala type ---------------------|------------------|---------------------|---------------------------------- Tuple | DataMap | record | case class <TypeName> Seq | DataList | array | <ItemName>Array extends IndexedSeq[T]
The "Tuple" encoding --------------------
- Example: Greetings~John~john@example.org
- JSON Equivalent: { "email": "john@example.org", "message": "Greetings", "recipient": "John"}
- Reserved chars: !~
- Escape char: !
StringKeyFormat tuples are positionally ordered. The order of the tuple values must match the order of fields in a pegasus record. E.g. the pegasus record:
{
"name": "...",
"type": "record",
"fields": [
{ "name": "message", "type": "..." },
{ "name": "recipient", "type": "..." },
{ "name": "email", "type": "..." }
]
}Would be required for the above tuple example.
An empty string is parsed to a tuple of size 1 containing a single empty string.
The "Seq" encoding ------------------
- Example: one~two~three
- JSON Equivalent: [ "one", "two", "three" ]
- Reserved chars: !,
- Escape char: !
An empty string is parsed to an empty Seq.
- Alphabetic
- By Inheritance
- StringKeyCodec
- DataCodec
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new StringKeyCodec(schema: DataSchema, prefix: Option[String] = None)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bytesToList(bytes: Array[Byte]): DataList
- Definition Classes
- StringKeyCodec → DataCodec
-
def
bytesToMap(bytes: Array[Byte]): DataMap
- Definition Classes
- StringKeyCodec → DataCodec
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
listToBytes(dataList: DataList): Array[Byte]
- Definition Classes
- StringKeyCodec → DataCodec
-
def
mapToBytes(dataMap: DataMap): Array[Byte]
- Definition Classes
- StringKeyCodec → DataCodec
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
readList(inputStream: InputStream): DataList
- Definition Classes
- StringKeyCodec → DataCodec
-
def
readMap(inputStream: InputStream): DataMap
- Definition Classes
- StringKeyCodec → DataCodec
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
writeList(dataList: DataList, outputStream: OutputStream): Unit
- Definition Classes
- StringKeyCodec → DataCodec
-
def
writeMap(dataMap: DataMap, outputStream: OutputStream): Unit
- Definition Classes
- StringKeyCodec → DataCodec