trait SizedBytes[T] extends Serializable
Type-class for working with a collection of bytes with a specific size.
- T
the underlying type of the collection
- Annotations
- @implicitNotFound()
- Alphabetic
- By Inheritance
- SizedBytes
- Serializable
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def fit(from: ByteVector, ordering: ByteOrdering): T
Fits the given
ByteVectorinto aTwith the expected size.Fits the given
ByteVectorinto aTwith the expected size. Truncates or pads as necessary defined by theByteOrdering.- from
the
ByteVectorto 'fit' into the expected size- ordering
the ordering of the bytes within the
ByteVector- returns
a
Tcontaining the expected number of bytes
- abstract def getClass(): Class[_ <: AnyRef]
- Definition Classes
- Any
- abstract def size: Int
The size of the byte vector
- abstract def toVector(t: T): ByteVector
Transforms the value of type
Tinto aByteVector.Transforms the value of type
Tinto aByteVector.- t
the value to transform
- returns
a
ByteVectorcontaining the bytes from collectionT
- abstract def validated(vector: ByteVector): Either[InvalidSize, T]
Validates that the given
ByteVectoris of the expected size.Validates that the given
ByteVectoris of the expected size.- vector
the
ByteVectorto validate and wrap as aSizedByteCollectionof typeT- returns
the validated
Tif the vector is of the specified size or anInvalidSizeerror
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 fit(from: ByteBuffer): T
Fits the given
ByteBufferinto aTwith the expected size.Fits the given
ByteBufferinto aTwith the expected size. Truncates or pads as necessary defined by the ordering of the buffer.- from
the
ByteBufferto 'fit' into the expected size- returns
a
Tcontaining the expected number of bytes
- def fit(from: Array[Byte], ordering: ByteOrdering): T
Fits the given
Array[Byte]into aTwith the expected size.Fits the given
Array[Byte]into aTwith the expected size. Truncates or pads as necessary defined by theByteOrdering.- from
the
Array[Byte]to 'fit' into the expected size- ordering
the ordering of the bytes within the
ByteVector- returns
a
Tcontaining the expected number of bytes
- def hashCode(): Int
- Definition Classes
- Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def toArray(t: T): Array[Byte]
Transforms the value of type
Tinto aArray[Byte].Transforms the value of type
Tinto aArray[Byte].- t
the value to transform
- returns
a
Array[Byte]containing the bytes from collectionT
- def toString(): String
- Definition Classes
- Any
- def validated(array: Array[Byte]): Either[InvalidSize, T]
Validates that the given
Array[Byte]is of the expected size.Validates that the given
Array[Byte]is of the expected size.- array
the
Array[Byte]to validate and transform into collectionT- returns
the validated
Tif the array is of the specified size or anInvalidSizeerror