Trait

fm.serializer

Output

Related Doc: package serializer

Permalink

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
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def allowStringMap: Boolean

    Permalink
    Definition Classes
    RawOutput
  2. abstract def writeFieldBigDecimal(number: Int, name: String, value: BigDecimal): Unit

    Permalink
    Definition Classes
    FieldOutput
  3. abstract def writeFieldBigInteger(number: Int, name: String, value: BigInteger): Unit

    Permalink
    Definition Classes
    FieldOutput
  4. abstract def writeFieldBool(number: Int, name: String, value: Boolean): Unit

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    FieldOutput
  20. abstract def writeNestedBigDecimal(value: BigDecimal): Unit

    Permalink
    Definition Classes
    NestedOutput
  21. abstract def writeNestedBigInteger(value: BigInteger): Unit

    Permalink
    Definition Classes
    NestedOutput
  22. abstract def writeNestedBool(value: Boolean): Unit

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    NestedOutput
  37. abstract def writeRawBigDecimal(value: BigDecimal): Unit

    Permalink
    Definition Classes
    RawOutput
  38. abstract def writeRawBigInteger(value: BigInteger): Unit

    Permalink
    Definition Classes
    RawOutput
  39. abstract def writeRawBool(value: Boolean): Unit

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

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

    Permalink

    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
  42. abstract def writeRawDouble(value: Double): Unit

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

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

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

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

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

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

    Permalink

    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
  49. abstract def writeRawSignedInt(value: Int): Unit

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

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

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

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

    Permalink
    Definition Classes
    RawOutput

Concrete Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from RawOutput

Inherited from NestedOutput

Inherited from FieldOutput

Inherited from AnyRef

Inherited from Any

Ungrouped