Abstract Value Members
-
abstract
def
allowStringMap: Boolean
-
abstract
def
writeFieldBool(number: Int, name: String, value: Boolean): Unit
-
abstract
def
writeFieldByteArray(number: Int, name: String, value: Array[Byte]): Unit
-
abstract
def
writeFieldCollection[T](number: Int, name: String, col: T)(f: (NestedOutput, T) ⇒ Unit): Unit
-
abstract
def
writeFieldDouble(number: Int, name: String, value: Double): Unit
-
abstract
def
writeFieldFixedInt(number: Int, name: String, value: Int): Unit
-
abstract
def
writeFieldFixedLong(number: Int, name: String, value: Long): Unit
-
abstract
def
writeFieldFloat(number: Int, name: String, value: Float): Unit
-
abstract
def
writeFieldInt(number: Int, name: String, value: Int): Unit
-
abstract
def
writeFieldLong(number: Int, name: String, value: Long): Unit
-
abstract
def
writeFieldNull(number: Int, name: String): Unit
-
abstract
def
writeFieldObject[T](number: Int, name: String, obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit
-
abstract
def
writeFieldSignedInt(number: Int, name: String, value: Int): Unit
-
abstract
def
writeFieldSignedLong(number: Int, name: String, value: Long): Unit
-
abstract
def
writeFieldString(number: Int, name: String, value: String): Unit
-
abstract
def
writeFieldUnsignedInt(number: Int, name: String, value: Int): Unit
-
abstract
def
writeFieldUnsignedLong(number: Int, name: String, value: Long): Unit
-
abstract
def
writeNestedBool(value: Boolean): Unit
-
abstract
def
writeNestedByteArray(value: Array[Byte]): Unit
-
abstract
def
writeNestedCollection[T](col: T)(f: (NestedOutput, T) ⇒ Unit): Unit
-
abstract
def
writeNestedDouble(value: Double): Unit
-
abstract
def
writeNestedFixedInt(value: Int): Unit
-
abstract
def
writeNestedFixedLong(value: Long): Unit
-
abstract
def
writeNestedFloat(value: Float): Unit
-
abstract
def
writeNestedInt(value: Int): Unit
-
abstract
def
writeNestedLong(value: Long): Unit
-
abstract
def
writeNestedObject[T](obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit
-
abstract
def
writeNestedSignedInt(value: Int): Unit
-
abstract
def
writeNestedSignedLong(value: Long): Unit
-
abstract
def
writeNestedString(value: String): Unit
-
abstract
def
writeNestedUnsignedInt(value: Int): Unit
-
abstract
def
writeNestedUnsignedLong(value: Long): Unit
-
abstract
def
writeRawBool(value: Boolean): Unit
-
abstract
def
writeRawByteArray(value: Array[Byte]): Unit
-
abstract
def
writeRawCollection[T](col: T)(f: (NestedOutput, T) ⇒ Unit): Unit
-
abstract
def
writeRawDouble(value: Double): Unit
-
abstract
def
writeRawFixedInt(value: Int): Unit
-
abstract
def
writeRawFixedLong(value: Long): Unit
-
abstract
def
writeRawFloat(value: Float): Unit
-
abstract
def
writeRawInt(value: Int): Unit
-
abstract
def
writeRawLong(value: Long): Unit
-
abstract
def
writeRawObject[T](obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit
-
abstract
def
writeRawSignedInt(value: Int): Unit
-
abstract
def
writeRawSignedLong(value: Long): Unit
-
abstract
def
writeRawString(value: String): Unit
-
abstract
def
writeRawUnsignedInt(value: Int): Unit
-
abstract
def
writeRawUnsignedLong(value: Long): Unit
Concrete Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
Generic Output trait to be implemented by Serialization Implementations
There are 3 classes of outputs:
RAW Raw output is what you get if you serialize something by itself. Depending on the serialization implementation it will probably have an implicit length determined by the length of an Array[Byte], String, InputStream, etc. The starting point for serializing something it usually invoking one of the writeRawXXX(...) methods. The writeRawXXX(...) methods should be implemented by all serialization implementations.
NESTED Nested output is what we use when something is serialized as part of something else and may or may not be different than RAW output depending on the serialization implementation. For example, when serializing a collection each element would be serialized using the writeNestedXXX(...) methods. The nested format might have additional length information compared to the RAW format since there is no implicit length. For example, in protocol buffers a string/object/collection is prefixed with its length. Most serialization implementations can probably write optional length information followed by calling the corresponding writeRawXXX(...) method.
Another way to think about nested output is what we should be able to deserialize a NESTED value that is in the middle of an array of bytes (or a string or whatever). This means we need to know when to stop reading the value. For something like Protocol Buffers we will be prepending the length for string/object/repeated field or have a marker bit for varints to know when to stop. For something like JSON we will hit a double-quote (for strings) for a comma or closing brace (for all other types).
FIELD Field output is used when writing fields of an object. In addition to the value we are serializing it contains the name/number of the field in the object. Most implementations will probably write out the field name/number information followed by a call to the corresponding writeNestedXXX(...) method. Some implementations, such as Protocol Buffers, writes out the type of the field as part of the name/number which is why there isn't just a writeFieldName(...) which the framework would call automatically followed by the appropriate writeNestedXXX(...).
NOTE - Reading field output (via Input) is broken into a readFieldNumber() call to get the name/number of the field followed by calls to readNestedXXX().
Things are broken out this way to mainly support more complex formats (like Protocol Buffers). For something like a JSON implementation the RAW and NESTED formats will probably be the same. The way in which we write out JSON fields as part of an object will also be the same no matter what the type is unlike something like Protocol Buffers which needs to encode the type of field as part of the name/number of the field.