trait ObjectInput extends SequentialInput
Represents an abstract source of key-value mappings that can be deserialized.
ObjectInput instance is stateful and MUST be read strictly
sequentially. This means, you MUST fully exhaust any Input instance
returned by nextField()
before calling nextField()
again. For this reason,
ObjectInput is not an Iterator
despite having similar interface
(Iterator
would easily allow e.g. conversion to List[(String, Input)]
which would be illegal).
ObjectInput MUST always be fully exhausted.
In order to ignore any remaining key-value mappings, skipRemaining()
may be used.
- Self Type
- ObjectInput
- Alphabetic
- By Inheritance
- ObjectInput
- SequentialInput
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
getClass(): Class[_]
- Definition Classes
- Any
-
abstract
def
hasNext: Boolean
- Definition Classes
- SequentialInput
-
abstract
def
nextField(): FieldInput
Returns FieldInput that represents next field of this object.
Returns FieldInput that represents next field of this object. You MUST NOT call
nextField()
again until this FieldInput is fully read or skipped.Serialization format implemented by this
ObjectInput
must either preserve order of fields (as they are written by correspondingObjectOutput
) OR it must provide random field access capability.- If the serialization format is able to preserve object field order then nextField must return
object fields in exactly the same order as they were written by
ObjectOutput.writeField
. This is natural for most serialization formats backed by strings, raw character or byte sequences, e.g. JSON implemented by JsonStringOutput/ JsonStringInput. - If the serialization format is unable to preserve object field order (e.g. because it uses hash maps to represent objects) then it must instead support random, by-name field access by overriding peekField.
- If the serialization format is able to preserve object field order then nextField must return
object fields in exactly the same order as they were written by
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
getNextNamedField(name: String): FieldInput
Tries to obtain FieldInput for field with specified name, either by using peekField (assuming format with random field access) or nextField (assuming format that preserves field order).
Tries to obtain FieldInput for field with specified name, either by using peekField (assuming format with random field access) or nextField (assuming format that preserves field order). A codec that uses this method must ensure that it reads fields in the same order as they were written using
writeField
on ObjectOutput. -
def
hashCode(): Int
- Definition Classes
- Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterator[A](readFun: (Input) ⇒ A): Iterator[(String, A)]
-
def
peekField(name: String): commons.Opt[FieldInput]
If serialization format implemented by
ObjectInput
does NOT preserve field order, then this method MUST be overridden to support random field access.If serialization format implemented by
ObjectInput
does NOT preserve field order, then this method MUST be overridden to support random field access. It should return non-empty Opt containing input for every field present in the object, regardless of field order assumed by nextField.Opt.Empty
is returned when field is absent or always when thisObjectInput
does not support random field access (in which case it must preserve field order instead). NOTE: calling peekField and using FieldInput returned by it MUST NOT change state of thisObjectInput
. Therefore, it cannot in any way influence results returned by nextField and hasNext. For example, if a FieldInput for particular field has already been accessed using peekField but has not yet been returned by nextField then it MUST be returned at some point in the future by nextField. -
def
skipRemaining(): Unit
- Definition Classes
- ObjectInput → SequentialInput
-
def
toString(): String
- Definition Classes
- Any