Package org.apache.pekko.util
Class ByteStringBuilder
- java.lang.Object
- 
- org.apache.pekko.util.ByteStringBuilder
 
- 
- All Implemented Interfaces:
- scala.collection.mutable.Builder<java.lang.Object,ByteString>,- scala.collection.mutable.Clearable,- scala.collection.mutable.Growable<java.lang.Object>
 
 public final class ByteStringBuilder extends java.lang.Object implements scala.collection.mutable.Builder<java.lang.Object,ByteString> A mutable builder for efficiently creating aByteString.The created ByteString is not automatically compacted. 
- 
- 
Constructor SummaryConstructors Constructor Description ByteStringBuilder()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteStringBuilder$plus$plus$eq(ByteString bytes)ByteStringBuilderaddAll(ByteString bytes)ByteStringBuilderaddAll(scala.collection.IterableOnce<java.lang.Object> xs)ByteStringBuilderaddOne(byte elem)ByteStringBuilderappend(ByteString bs)Java API: append a ByteString to this builder.java.io.OutputStreamasOutputStream()Directly wraps this ByteStringBuilder in an OutputStream.voidclear()protected ByteStringBuilderfillArray(int len, scala.Function2<byte[],java.lang.Object,scala.runtime.BoxedUnit> fill)protected ByteStringBuilderfillByteBuffer(int len, java.nio.ByteOrder byteOrder, scala.Function1<java.nio.ByteBuffer,scala.runtime.BoxedUnit> fill)booleanisEmpty()Tests whether this ByteStringBuilder is empty.intlength()booleannonEmpty()Tests whether this ByteStringBuilder is not empty.ByteStringBuilderputByte(byte x)Add a single Byte to this builder.ByteStringBuilderputBytes(byte[] array)Add a number of Bytes from an array to this builder.ByteStringBuilderputBytes(byte[] array, int start, int len)Add a number of Bytes from an array to this builder.ByteStringBuilderputDouble(double x, java.nio.ByteOrder byteOrder)Add a single Double to this builder.ByteStringBuilderputDoubles(double[] array, int start, int len, java.nio.ByteOrder byteOrder)Add a number of Doubles from an array to this builder.ByteStringBuilderputDoubles(double[] array, java.nio.ByteOrder byteOrder)Add a number of Doubles from an array to this builder.ByteStringBuilderputFloat(float x, java.nio.ByteOrder byteOrder)Add a single Float to this builder.ByteStringBuilderputFloats(float[] array, int start, int len, java.nio.ByteOrder byteOrder)Add a number of Floats from an array to this builder.ByteStringBuilderputFloats(float[] array, java.nio.ByteOrder byteOrder)Add a number of Floats from an array to this builder.ByteStringBuilderputInt(int x, java.nio.ByteOrder byteOrder)Add a single Int to this builder.ByteStringBuilderputInts(int[] array, int start, int len, java.nio.ByteOrder byteOrder)Add a number of Ints from an array to this builder.ByteStringBuilderputInts(int[] array, java.nio.ByteOrder byteOrder)Add a number of Ints from an array to this builder.ByteStringBuilderputLong(long x, java.nio.ByteOrder byteOrder)Add a single Long to this builder.ByteStringBuilderputLongPart(long x, int n, java.nio.ByteOrder byteOrder)Add thenleast significant bytes of the given Long to this builder.ByteStringBuilderputLongs(long[] array, int start, int len, java.nio.ByteOrder byteOrder)Add a number of Longs from an array to this builder.ByteStringBuilderputLongs(long[] array, java.nio.ByteOrder byteOrder)Add a number of Longs from an array to this builder.ByteStringBuilderputShort(int x, java.nio.ByteOrder byteOrder)Add a single Short to this builder.ByteStringBuilderputShorts(short[] array, int start, int len, java.nio.ByteOrder byteOrder)Add a number of Shorts from an array to this builder.ByteStringBuilderputShorts(short[] array, java.nio.ByteOrder byteOrder)Add a number of Shorts from an array to this builder.ByteStringresult()voidsizeHint(int len)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
- 
 
- 
- 
- 
Method Detail- 
$plus$plus$eqpublic ByteStringBuilder $plus$plus$eq(ByteString bytes) 
 - 
addAllpublic ByteStringBuilder addAll(ByteString bytes) 
 - 
addAllpublic ByteStringBuilder addAll(scala.collection.IterableOnce<java.lang.Object> xs) - Specified by:
- addAllin interface- scala.collection.mutable.Growable<java.lang.Object>
 
 - 
addOnepublic ByteStringBuilder addOne(byte elem) 
 - 
appendpublic ByteStringBuilder append(ByteString bs) Java API: append a ByteString to this builder.
 - 
asOutputStreampublic java.io.OutputStream asOutputStream() Directly wraps this ByteStringBuilder in an OutputStream. Write operations on the stream are forwarded to the builder.
 - 
clearpublic void clear() - Specified by:
- clearin interface- scala.collection.mutable.Builder<java.lang.Object,ByteString>
- Specified by:
- clearin interface- scala.collection.mutable.Clearable
 
 - 
fillArrayprotected ByteStringBuilder fillArray(int len, scala.Function2<byte[],java.lang.Object,scala.runtime.BoxedUnit> fill) 
 - 
fillByteBufferprotected final ByteStringBuilder fillByteBuffer(int len, java.nio.ByteOrder byteOrder, scala.Function1<java.nio.ByteBuffer,scala.runtime.BoxedUnit> fill) 
 - 
isEmptypublic boolean isEmpty() Tests whether this ByteStringBuilder is empty.
 - 
lengthpublic int length() 
 - 
nonEmptypublic boolean nonEmpty() Tests whether this ByteStringBuilder is not empty.
 - 
putBytepublic ByteStringBuilder putByte(byte x) Add a single Byte to this builder.
 - 
putBytespublic ByteStringBuilder putBytes(byte[] array) Add a number of Bytes from an array to this builder.
 - 
putBytespublic ByteStringBuilder putBytes(byte[] array, int start, int len) Add a number of Bytes from an array to this builder.
 - 
putDoublepublic ByteStringBuilder putDouble(double x, java.nio.ByteOrder byteOrder) Add a single Double to this builder.
 - 
putDoublespublic ByteStringBuilder putDoubles(double[] array, java.nio.ByteOrder byteOrder) Add a number of Doubles from an array to this builder.
 - 
putDoublespublic ByteStringBuilder putDoubles(double[] array, int start, int len, java.nio.ByteOrder byteOrder) Add a number of Doubles from an array to this builder.
 - 
putFloatpublic ByteStringBuilder putFloat(float x, java.nio.ByteOrder byteOrder) Add a single Float to this builder.
 - 
putFloatspublic ByteStringBuilder putFloats(float[] array, java.nio.ByteOrder byteOrder) Add a number of Floats from an array to this builder.
 - 
putFloatspublic ByteStringBuilder putFloats(float[] array, int start, int len, java.nio.ByteOrder byteOrder) Add a number of Floats from an array to this builder.
 - 
putIntpublic ByteStringBuilder putInt(int x, java.nio.ByteOrder byteOrder) Add a single Int to this builder.
 - 
putIntspublic ByteStringBuilder putInts(int[] array, java.nio.ByteOrder byteOrder) Add a number of Ints from an array to this builder.
 - 
putIntspublic ByteStringBuilder putInts(int[] array, int start, int len, java.nio.ByteOrder byteOrder) Add a number of Ints from an array to this builder.
 - 
putLongpublic ByteStringBuilder putLong(long x, java.nio.ByteOrder byteOrder) Add a single Long to this builder.
 - 
putLongPartpublic ByteStringBuilder putLongPart(long x, int n, java.nio.ByteOrder byteOrder) Add thenleast significant bytes of the given Long to this builder.
 - 
putLongspublic ByteStringBuilder putLongs(long[] array, java.nio.ByteOrder byteOrder) Add a number of Longs from an array to this builder.
 - 
putLongspublic ByteStringBuilder putLongs(long[] array, int start, int len, java.nio.ByteOrder byteOrder) Add a number of Longs from an array to this builder.
 - 
putShortpublic ByteStringBuilder putShort(int x, java.nio.ByteOrder byteOrder) Add a single Short to this builder.
 - 
putShortspublic ByteStringBuilder putShorts(short[] array, java.nio.ByteOrder byteOrder) Add a number of Shorts from an array to this builder.
 - 
putShortspublic ByteStringBuilder putShorts(short[] array, int start, int len, java.nio.ByteOrder byteOrder) Add a number of Shorts from an array to this builder.
 - 
resultpublic ByteString result() - Specified by:
- resultin interface- scala.collection.mutable.Builder<java.lang.Object,ByteString>
 
 - 
sizeHintpublic void sizeHint(int len) - Specified by:
- sizeHintin interface- scala.collection.mutable.Builder<java.lang.Object,ByteString>
 
 
- 
 
-