trait Output extends Any
Represents an abstract sink to which a value may be serialized (written).
An Output
instance should be assumed to be stateful. After calling any of the write
methods, it MUST NOT be
reused. This means that Output
instance can be used only to write a single value. However, if the value
to write is complex, one can use writeList
/writeSet
or writeObject
/writeMap
.
- Alphabetic
- By Inheritance
- Output
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
getClass(): Class[_]
- Definition Classes
- Any
- abstract def writeList(): ListOutput
- abstract def writeNull(): Unit
- abstract def writeObject(): ObjectOutput
- abstract def writeSimple(): SimpleOutput
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
equals(arg0: Any): Boolean
- Definition Classes
- Any
-
def
hashCode(): Int
- Definition Classes
- Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
keepsMetadata(metadata: InputMetadata[_]): Boolean
Determines whether serialization format implemented by this
Output
preserves particular arbitrary "metadata" which is identified by InputMetadata which is usually an object (e.g.Determines whether serialization format implemented by this
Output
preserves particular arbitrary "metadata" which is identified by InputMetadata which is usually an object (e.g. companion object of metadata value typeT
). An example of InputMetadata is JsonType supported by JsonStringOutput.If this method returns
true
then codec may optimize its encoded format and assume that a correspondingInput
implementation will return a non-emptyOpt
from itsreadMetadata
implementation when passed the same InputMetadata identifier. If this method returnsfalse
then thisOutput
does not support this medatata type and codec should fall back to some other serialization strategy. -
def
legacyOptionEncoding: Boolean
This ugly workaround has been introduced when standard
Option
encoding changed from zero-or-one element list encoding to unwrapped-or-null encoding which effectively disallowed serializingnull
andSome(null)
.This ugly workaround has been introduced when standard
Option
encoding changed from zero-or-one element list encoding to unwrapped-or-null encoding which effectively disallowed serializingnull
andSome(null)
. If someOutput
implementation still wants to use the list encoding, it may do it by overriding this method and returningtrue
. -
def
toString(): String
- Definition Classes
- Any
-
def
writeCustom[T](typeMarker: TypeMarker[T], value: T): Boolean
Attempts to write some arbitrary custom "native" value that this output may or may not support.
Attempts to write some arbitrary custom "native" value that this output may or may not support. The custom type is identified by an instance of
TypeMarker
which is usually an object (e.g. companion object of the customT
type itself). This wayInput
andOutput
implementations may support other native types than the ones supported by default byInput
andOutput
interfaces.Codecs may use this method to optimize encoded format in case it it possible with particular
Output
implementation.GenCodec
may generally assume that if this method returnstrue
then correspondingInput
will return a non-emptyOpt
fromreadCustom
method.false
returned by this method indicates that this output does not support this particular type. In such situation the codec must fall back to some other strategy. If the native type is supported but there was some error writing it then aWriteFailure
should be thrown instead of returningfalse
.