ByteBuilder

upickle.core.ByteBuilder
class ByteBuilder(startSize: Int) extends ByteAppendC

A fast buffer that can be used to store Bytes (Bytes or Chars).

Generally faster than the equivalent StringBuilder or java.io.ByteArrayOutputStream, since:

  • It is specialized and without the overhead of polymorphism or synchronization.
  • It allows the user to call ensureLength and appendUnsafe separately, e.g. callign ensureLength once before appendUnsafe-ing multiple Bytes
  • It provides fast methods like makeString or writeOutToIfLongerThan, that let you push the data elsewhere with minimal unnecessary copying

Attributes

Graph
Supertypes
class ByteAppendC
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def append(x: Int): Unit
def append(x: Byte): Unit
def appendAll(bytes: Array[Byte], bytesLength: Int): Unit
def appendAll(bytes: Array[Byte], bytesStart: Int, bytesLength: Int): Unit
def appendAllUnsafe(other: ByteBuilder): Unit
def appendUnsafe(x: Byte): Unit
def appendUnsafeC(x: Char): Unit
def ensureLength(increment: Int): Unit
def getLength: Int
def makeString(): String
def reset(): Unit
def writeOutToIfLongerThan(writer: Output, threshold: Int): Unit

Inherited methods

def appendC(x: Char): Unit

Attributes

Inherited from:
ByteAppendC
def convertSurrogate(firstPart: Int, secondPart: Int): Int

Attributes

Inherited from:
ByteAppendC

Concrete fields

var arr: Array[Byte]
var length: Int