object Buf

Buf wrapper-types (like Buf.ByteArray and Buf.ByteBuffer) provide "shared" and "owned" APIs, each of which contain construction and extraction utilities. While the owned and shared nomenclature is unintuitive, their purpose and use cases are straightforward.

A "shared" Buf means that steps are taken to ensure that the produced Buf shares no state with the producer. This typically implies defensive copying and should be used when you do not control the lifecycle or usage of the passed in data.

The "owned" APIs may provide direct access to a Buf's underlying implementation; and so mutating the underlying data structure invalidates a Buf's immutability constraint. Users must take care to handle this data immutably.

Note: There are Java-friendly APIs for this object at com.twitter.io.Bufs.

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

Type Members

  1. class ByteArray extends Buf

    A buffer representing an array of bytes.

  2. class ByteBuffer extends Buf

    A buffer representing the remaining bytes in the given java.nio.ByteBuffer.

    A buffer representing the remaining bytes in the given java.nio.ByteBuffer. The given buffer will not be affected.

    Modifications to the ByteBuffer's content will be visible to the resulting Buf. The ByteBuffer should be immutable in practice.

  3. abstract class Processor extends AnyRef

    returns

    true if the processor would like to continue processing more bytes and false otherwise.

    Note

    this is not a Function1[Byte, Boolean] despite very much fitting that interface. This was done to avoiding boxing of the Bytes which was quite squirrely and had an impact on performance.

    See also

    process(Processor)

  4. abstract class StringCoder extends AnyRef

    A StringCoder for a given java.nio.charset.Charset provides an encoder: String to Buf and an extractor: Buf to Some[String].

    A StringCoder for a given java.nio.charset.Charset provides an encoder: String to Buf and an extractor: Buf to Some[String].

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    See also

    Utf8 for UTF-8 encoding and decoding, and Bufs.UTF8 for Java users. Constants exist for other standard charsets as well.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val Empty: Buf

    An empty buffer.

  5. def apply(bufs: Iterable[Buf]): Buf

    Create a Buf out of the given Bufs.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def checkSliceArgs(from: Int, until: Int): Unit

    Helps Buf implementations validate the arguments to slicing functions.

  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  9. def decodeString(buf: Buf, charset: Charset): String

    Decode a Buf using the specified Charset

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(x: Buf, y: Buf): Boolean

    Byte equality between two buffers.

  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hash(buf: Buf): Int

    The 32-bit FNV-1 of Buf

  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. def slowFromHexString(hex: String): Buf

    Convert a hex string (eg one from slowHexString above) to a Buf of the string contents interpreted as a string of hexadecimal numbers.

    Convert a hex string (eg one from slowHexString above) to a Buf of the string contents interpreted as a string of hexadecimal numbers.

    If an invalid string is passed to this method, the return value is not defined. It may throw or it may return a bogus Buf value.

  22. def slowHexString(buf: Buf): String

    Return a string representing the buffer contents in hexadecimal.

  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  28. object ByteArray
  29. object ByteBuffer
  30. object Iso8859_1 extends StringCoder

    Create and deconstruct buffers encoded by the ISO Latin Alphabet No.

    Create and deconstruct buffers encoded by the ISO Latin Alphabet No. 1 charset.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.ISO_8859_1 for a Java-friendly API.

  31. object U128BE

    Create and deconstruct unsigned 128-bit big endian encoded buffers.

    Create and deconstruct unsigned 128-bit big endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  32. object U128LE

    Create and deconstruct unsigned 128-bit little endian encoded buffers.

    Create and deconstruct unsigned 128-bit little endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  33. object U32BE

    Create and deconstruct unsigned 32-bit big endian encoded buffers.

    Create and deconstruct unsigned 32-bit big endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  34. object U32LE

    Create and deconstruct unsigned 32-bit little endian encoded buffers.

    Create and deconstruct unsigned 32-bit little endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  35. object U64BE

    Create and deconstruct unsigned 64-bit big endian encoded buffers.

    Create and deconstruct unsigned 64-bit big endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  36. object U64LE

    Create and deconstruct unsigned 64-bit little endian encoded buffers.

    Create and deconstruct unsigned 64-bit little endian encoded buffers.

    Deconstructing will return the value as well as the remaining buffer.

  37. object UsAscii extends StringCoder

    Create and deconstruct buffers encoded by the 7-bit ASCII, also known as ISO646-US or the Basic Latin block of the Unicode character set.

    Create and deconstruct buffers encoded by the 7-bit ASCII, also known as ISO646-US or the Basic Latin block of the Unicode character set.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.US_ASCII for a Java-friendly API.

  38. object Utf16 extends StringCoder

    Create and deconstruct 16-bit UTF buffers.

    Create and deconstruct 16-bit UTF buffers.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.UTF_16 for a Java-friendly API.

  39. object Utf16BE extends StringCoder

    Create and deconstruct buffers encoded by the 16-bit UTF charset with big-endian byte order.

    Create and deconstruct buffers encoded by the 16-bit UTF charset with big-endian byte order.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.UTF_16BE for a Java-friendly API.

  40. object Utf16LE extends StringCoder

    Create and deconstruct buffers encoded by the 16-bit UTF charset with little-endian byte order.

    Create and deconstruct buffers encoded by the 16-bit UTF charset with little-endian byte order.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.UTF_16LE for a Java-friendly API.

  41. object Utf8 extends StringCoder

    Create and deconstruct Utf-8 encoded buffers.

    Create and deconstruct Utf-8 encoded buffers.

    Note

    Malformed and unmappable input is silently replaced see java.nio.charset.CodingErrorAction.REPLACE

    ,

    See com.twitter.io.Bufs.UTF_8 for a Java-friendly API.

Inherited from AnyRef

Inherited from Any

Ungrouped