Trait/Object

com.stripe.agate.tensor

ToBytes

Related Docs: object ToBytes | package tensor

Permalink

trait ToBytes[A] extends AnyRef

A type class for serializing values of type A into bytes.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ToBytes
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def put(os: OutputStream, n: A): Unit

    Permalink
  2. abstract def read(bytes: Array[Byte], offset: Int): A

    Permalink
  3. abstract def strategy: Strategy[A]

    Permalink

    The strategy is used to determine whether values of type A are a "fixed length" encoding or "variable length" encoding.

    The strategy is used to determine whether values of type A are a "fixed length" encoding or "variable length" encoding. In the case of fixed length encodings, the same amount of bytes will always be used to serialize a value. For example, all Int values require 4 bytes. To serialize a tensor, we can just encode all the values in row-major order. For types with a variable length encoding, like ByteString, each value may require a different number of bytes. In this case, we need to be able to quickly determine the size of a serialized value at runtime. This size can be used when serializing a tensor to compute an index of offsets, which can be serialized along with the data. The index allows for random access into the serialized data.

    Note: Ideally, we'd just have 2 sub-classes of ToBytes to describe the different strategies, but this doesn't play well with specialization and pattern matching.

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. def isFixedLength: Boolean

    Permalink
  12. final def isInstanceOf[T0]: Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef
  16. def size(a: A): Int

    Permalink

    Returns the number of bytes required to serialize a.

    Returns the number of bytes required to serialize a.

    Note: pattern matching on strategy in a specialized context leads to compile time type errors in the specialized implementations. This method should be used the size is required, since this kind of indirection to get things working correctly.

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped