trait Input extends Any
Represents an abstract source from which a value may be deserialized (read).
Each of the read
methods tries to read a value of specified type and may throw an exception
(usually ReadFailure) when reading is not successful.
An Input
value should be assumed to be stateful. If any of the readX
methods have already been called,
the Input
instance can no longer be used and MUST be discarded.
In order to ignore the value kept in this Input
, skip()
MUST be called.
In summary: every Input
MUST be fully exhausted by either calling one of the read
methods which returns
successful value or by calling skip()
. Also, ListInput and ObjectInput instances returned from this
Input
must also be fully exhausted on their own.
- Alphabetic
- By Inheritance
- Input
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
getClass(): Class[_]
- Definition Classes
- Any
- abstract def readList(): ListInput
-
abstract
def
readNull(): Boolean
Attempts to read
null
value from anInput
.Attempts to read
null
value from anInput
. Returningtrue
means that input instance contained anull
value. Its state should then be changed so that input can be considered "consumed" (no other reads are possible on this instance). Returningfalse
means that the input contains something else than anull
value. Its state must not change in this situation and it must be possible to call some other read method on it. - abstract def readObject(): ObjectInput
- abstract def readSimple(): SimpleInput
-
abstract
def
skip(): Unit
Ignores this input and skips its contents internally, if necessary
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
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 someInput
implementation still wants to use the list encoding, it may do it by overriding this method and returningtrue
. -
def
readCustom[T](typeMarker: TypeMarker[T]): commons.Opt[T]
Attempts to read some arbitrary custom "native" value that this input may or may not support.
Attempts to read some arbitrary custom "native" value that this input 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
Input
implementation.GenCodec
may generally assume that if the data was written by a correspondingOutput
which also support this custom native type thenreadCustom
should return non-empty value.Opt.Empty
returned by this method indicates that this input does not support this particular type. If it supports it but there was some error reading it then aReadFailure
should be thrown instead of returningOpt.Empty
. -
def
readMetadata[T](metadata: InputMetadata[T]): commons.Opt[T]
Attempts to read some arbitrary "metadata" about this input instance.
Attempts to read some arbitrary "metadata" about this input instance. Metadata is identified by InputMetadata which is usually an object (e.g. companion object of metadata value type
T
). An example of InputMetadata is JsonType supported by JsonStringInput.Codecs may use this method to optimize encoded format in case it it possible with particular
Input
implementation.GenCodec
may generally assume that if the data was written by a correspondingOutput
that preserves particular metadata type (which may be determined byOutput.keepsMetadata()
) thenreadMetadata
will return a non-empty value.Opt.Empty
may be returned form this method ONLY if thisInput
implementation does not support this metadata type AT ALL. Any errors should be signaled by throwingReadFailure
. -
def
toString(): String
- Definition Classes
- Any