Package org.apache.pekko.util
Class ByteStringBuilder
java.lang.Object
org.apache.pekko.util.ByteStringBuilder
- All Implemented Interfaces:
scala.collection.mutable.Builder<Object,
,ByteString> scala.collection.mutable.Clearable
,scala.collection.mutable.Growable<Object>
public final class ByteStringBuilder
extends Object
implements scala.collection.mutable.Builder<Object,ByteString>
A mutable builder for efficiently creating a
ByteString
.
The created ByteString is not automatically compacted.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription$plus$plus$eq
(ByteString bytes) addAll
(ByteString bytes) addOne
(byte elem) append
(ByteString bs) Java API: append a ByteString to this builder.Directly wraps this ByteStringBuilder in an OutputStream.void
clear()
protected ByteStringBuilder
protected final ByteStringBuilder
fillByteBuffer
(int len, ByteOrder byteOrder, scala.Function1<ByteBuffer, scala.runtime.BoxedUnit> fill) boolean
isEmpty()
Tests whether this ByteStringBuilder is empty.int
length()
boolean
nonEmpty()
Tests whether this ByteStringBuilder is not empty.putByte
(byte x) Add a single Byte to this builder.putBytes
(byte[] array) Add a number of Bytes from an array to this builder.putBytes
(byte[] array, int start, int len) Add a number of Bytes from an array to this builder.Add a single Double to this builder.putDoubles
(double[] array, int start, int len, ByteOrder byteOrder) Add a number of Doubles from an array to this builder.putDoubles
(double[] array, ByteOrder byteOrder) Add a number of Doubles from an array to this builder.Add a single Float to this builder.Add a number of Floats from an array to this builder.Add a number of Floats from an array to this builder.Add a single Int to this builder.Add a number of Ints from an array to this builder.Add a number of Ints from an array to this builder.Add a single Long to this builder.putLongPart
(long x, int n, ByteOrder byteOrder) Add then
least significant bytes of the given Long to this builder.Add a number of Longs from an array to this builder.Add a number of Longs from an array to this builder.Add a single Short to this builder.Add a number of Shorts from an array to this builder.Add a number of Shorts from an array to this builder.result()
void
sizeHint
(int len) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface scala.collection.mutable.Builder
mapResult, sizeHint, sizeHint$default$2, sizeHintBounded
Methods inherited from interface scala.collection.mutable.Growable
$plus$eq, $plus$eq, $plus$plus$eq, addOne, knownSize
-
Constructor Details
-
ByteStringBuilder
public ByteStringBuilder()
-
-
Method Details
-
$plus$plus$eq
-
addAll
-
addAll
- Specified by:
addAll
in interfacescala.collection.mutable.Growable<Object>
-
addOne
-
append
Java API: append a ByteString to this builder. -
asOutputStream
Directly wraps this ByteStringBuilder in an OutputStream. Write operations on the stream are forwarded to the builder. -
clear
public void clear()- Specified by:
clear
in interfacescala.collection.mutable.Builder<Object,
ByteString> - Specified by:
clear
in interfacescala.collection.mutable.Clearable
-
fillArray
protected ByteStringBuilder fillArray(int len, scala.Function2<byte[], Object, scala.runtime.BoxedUnit> fill) -
fillByteBuffer
protected final ByteStringBuilder fillByteBuffer(int len, ByteOrder byteOrder, scala.Function1<ByteBuffer, scala.runtime.BoxedUnit> fill) -
isEmpty
public boolean isEmpty()Tests whether this ByteStringBuilder is empty. -
length
public int length() -
nonEmpty
public boolean nonEmpty()Tests whether this ByteStringBuilder is not empty. -
putByte
Add a single Byte to this builder. -
putBytes
Add a number of Bytes from an array to this builder. -
putBytes
Add a number of Bytes from an array to this builder. -
putDouble
Add a single Double to this builder. -
putDoubles
Add a number of Doubles from an array to this builder. -
putDoubles
Add a number of Doubles from an array to this builder. -
putFloat
Add a single Float to this builder. -
putFloats
Add a number of Floats from an array to this builder. -
putFloats
Add a number of Floats from an array to this builder. -
putInt
Add a single Int to this builder. -
putInts
Add a number of Ints from an array to this builder. -
putInts
Add a number of Ints from an array to this builder. -
putLong
Add a single Long to this builder. -
putLongPart
Add then
least significant bytes of the given Long to this builder. -
putLongs
Add a number of Longs from an array to this builder. -
putLongs
Add a number of Longs from an array to this builder. -
putShort
Add a single Short to this builder. -
putShorts
Add a number of Shorts from an array to this builder. -
putShorts
Add a number of Shorts from an array to this builder. -
result
- Specified by:
result
in interfacescala.collection.mutable.Builder<Object,
ByteString>
-
sizeHint
public void sizeHint(int len) - Specified by:
sizeHint
in interfacescala.collection.mutable.Builder<Object,
ByteString>
-