fm.serializer

Output

trait Output extends FieldOutput with NestedOutput with RawOutput

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.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Output
  2. RawOutput
  3. NestedOutput
  4. FieldOutput
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def allowStringMap: Boolean

    Definition Classes
    RawOutput
  2. abstract def writeFieldBool(number: Int, name: String, value: Boolean): Unit

    Definition Classes
    FieldOutput
  3. abstract def writeFieldByteArray(number: Int, name: String, value: Array[Byte]): Unit

    Definition Classes
    FieldOutput
  4. abstract def writeFieldCollection[T](number: Int, name: String, col: T)(f: (NestedOutput, T) ⇒ Unit): Unit

    Definition Classes
    FieldOutput
  5. abstract def writeFieldDouble(number: Int, name: String, value: Double): Unit

    Definition Classes
    FieldOutput
  6. abstract def writeFieldFixedInt(number: Int, name: String, value: Int): Unit

    Definition Classes
    FieldOutput
  7. abstract def writeFieldFixedLong(number: Int, name: String, value: Long): Unit

    Definition Classes
    FieldOutput
  8. abstract def writeFieldFloat(number: Int, name: String, value: Float): Unit

    Definition Classes
    FieldOutput
  9. abstract def writeFieldInt(number: Int, name: String, value: Int): Unit

    Definition Classes
    FieldOutput
  10. abstract def writeFieldLong(number: Int, name: String, value: Long): Unit

    Definition Classes
    FieldOutput
  11. abstract def writeFieldNull(number: Int, name: String): Unit

    Definition Classes
    FieldOutput
  12. abstract def writeFieldObject[T](number: Int, name: String, obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit

    Definition Classes
    FieldOutput
  13. abstract def writeFieldSignedInt(number: Int, name: String, value: Int): Unit

    Definition Classes
    FieldOutput
  14. abstract def writeFieldSignedLong(number: Int, name: String, value: Long): Unit

    Definition Classes
    FieldOutput
  15. abstract def writeFieldString(number: Int, name: String, value: String): Unit

    Definition Classes
    FieldOutput
  16. abstract def writeFieldUnsignedInt(number: Int, name: String, value: Int): Unit

    Definition Classes
    FieldOutput
  17. abstract def writeFieldUnsignedLong(number: Int, name: String, value: Long): Unit

    Definition Classes
    FieldOutput
  18. abstract def writeNestedBool(value: Boolean): Unit

    Definition Classes
    NestedOutput
  19. abstract def writeNestedByteArray(value: Array[Byte]): Unit

    Definition Classes
    NestedOutput
  20. abstract def writeNestedCollection[T](col: T)(f: (NestedOutput, T) ⇒ Unit): Unit

    Definition Classes
    NestedOutput
  21. abstract def writeNestedDouble(value: Double): Unit

    Definition Classes
    NestedOutput
  22. abstract def writeNestedFixedInt(value: Int): Unit

    Definition Classes
    NestedOutput
  23. abstract def writeNestedFixedLong(value: Long): Unit

    Definition Classes
    NestedOutput
  24. abstract def writeNestedFloat(value: Float): Unit

    Definition Classes
    NestedOutput
  25. abstract def writeNestedInt(value: Int): Unit

    Definition Classes
    NestedOutput
  26. abstract def writeNestedLong(value: Long): Unit

    Definition Classes
    NestedOutput
  27. abstract def writeNestedObject[T](obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit

    Definition Classes
    NestedOutput
  28. abstract def writeNestedSignedInt(value: Int): Unit

    Definition Classes
    NestedOutput
  29. abstract def writeNestedSignedLong(value: Long): Unit

    Definition Classes
    NestedOutput
  30. abstract def writeNestedString(value: String): Unit

    Definition Classes
    NestedOutput
  31. abstract def writeNestedUnsignedInt(value: Int): Unit

    Definition Classes
    NestedOutput
  32. abstract def writeNestedUnsignedLong(value: Long): Unit

    Definition Classes
    NestedOutput
  33. abstract def writeRawBool(value: Boolean): Unit

    Definition Classes
    RawOutput
  34. abstract def writeRawByteArray(value: Array[Byte]): Unit

    Definition Classes
    RawOutput
  35. abstract def writeRawCollection[T](col: T)(f: (NestedOutput, T) ⇒ Unit): Unit

    Write out a RAW collection.

    Write out a RAW collection. This method will wrap the collection in whatever leading/trailing "stuff" is needed (e.g. length prefixing, leading/trailing chars, etc...). The method that you pass in should use the Output instance to make repeated calls to a single write

    Definition Classes
    RawOutput
  36. abstract def writeRawDouble(value: Double): Unit

    Definition Classes
    RawOutput
  37. abstract def writeRawFixedInt(value: Int): Unit

    Definition Classes
    RawOutput
  38. abstract def writeRawFixedLong(value: Long): Unit

    Definition Classes
    RawOutput
  39. abstract def writeRawFloat(value: Float): Unit

    Definition Classes
    RawOutput
  40. abstract def writeRawInt(value: Int): Unit

    Definition Classes
    RawOutput
  41. abstract def writeRawLong(value: Long): Unit

    Definition Classes
    RawOutput
  42. abstract def writeRawObject[T](obj: T)(f: (FieldOutput, T) ⇒ Unit): Unit

    For writing objects.

    For writing objects. Note: that the obj is passed in for null handling by the implementation. If the object is not null then the function f will be called so the caller can write out the fields

    Definition Classes
    RawOutput
  43. abstract def writeRawSignedInt(value: Int): Unit

    Definition Classes
    RawOutput
  44. abstract def writeRawSignedLong(value: Long): Unit

    Definition Classes
    RawOutput
  45. abstract def writeRawString(value: String): Unit

    Definition Classes
    RawOutput
  46. abstract def writeRawUnsignedInt(value: Int): Unit

    Definition Classes
    RawOutput
  47. abstract def writeRawUnsignedLong(value: Long): Unit

    Definition Classes
    RawOutput

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def toString(): String

    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from RawOutput

Inherited from NestedOutput

Inherited from FieldOutput

Inherited from AnyRef

Inherited from Any

Ungrouped