Package org.apache.pekko.util
Class ByteString.ByteStrings
java.lang.Object
org.apache.pekko.util.ByteString
org.apache.pekko.util.ByteString.ByteStrings
- All Implemented Interfaces:
Serializable,scala.collection.immutable.IndexedSeq<Object>,scala.collection.immutable.IndexedSeqOps<Object,,scala.collection.immutable.IndexedSeq, scala.collection.immutable.IndexedSeq<Object>> scala.collection.immutable.Iterable<Object>,scala.collection.immutable.Seq<Object>,scala.collection.immutable.SeqOps<Object,,scala.collection.immutable.Seq, scala.collection.immutable.Seq<Object>> scala.collection.immutable.StrictOptimizedSeqOps<Object,,scala.collection.immutable.IndexedSeq, ByteString> scala.collection.IndexedSeq<Object>,scala.collection.IndexedSeqOps<Object,,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> scala.collection.Iterable<Object>,scala.collection.IterableFactoryDefaults<Object,,scala.collection.Iterable> scala.collection.IterableOnce<Object>,scala.collection.IterableOnceOps<Object,,scala.collection.Iterable, scala.collection.Iterable> scala.collection.IterableOps<Object,,scala.collection.Iterable, scala.collection.Iterable> scala.collection.Seq<Object>,scala.collection.SeqOps<Object,,scala.collection.Seq, scala.collection.Seq<Object>> scala.collection.StrictOptimizedIterableOps<Object,,scala.collection.immutable.IndexedSeq, ByteString> scala.collection.StrictOptimizedSeqOps<Object,,scala.collection.immutable.IndexedSeq, ByteString> scala.Equals,scala.Function1<Object,,Object> scala.PartialFunction<Object,Object>
- Enclosing class:
- ByteString
A ByteString with 2 or more fragments.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.util.ByteString
ByteString.ByteString1, ByteString.ByteString1$, ByteString.ByteString1C, ByteString.ByteString1C$, ByteString.ByteStrings, ByteString.ByteStrings$, ByteString.Companion, ByteString.Companion$Nested classes/interfaces inherited from interface scala.Function1
scala.Function1.UnliftOps<A extends Object,B extends Object>, scala.Function1.UnliftOps$ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription$plus$plus(ByteString that) Efficiently concatenate another ByteString.byteapply(int idx) Returns a read-only ByteBuffer that directly wraps this ByteString if it is not fragmented.scala.collection.immutable.Iterable<ByteBuffer>Scala API: Returns an immutable Iterable of read-only ByteBuffers that directly wraps this ByteStrings all fragments.Return the bytes in this ByteString as an InputStream.compact()Create a new ByteString with all contents compacted into a single, full byte array.<B> intcopyToArray(Object dest, int start, int len) intcopyToBuffer(ByteBuffer buffer) Copy as many bytes as possible to a ByteBuffer, starting from it's current position.Returns a ByteString which is the binary representation of this ByteString if this ByteString is Base64-encoded.decodeString(String charset) Decodes this ByteString using a charset to produce a String.decodeString(Charset charset) Decodes this ByteString using a charset to produce a String.drop(int n) dropRight(int n) Returns a ByteString which is the Base64 representation of this ByteStringintindexOf(byte elem, int from) Finds index of first occurrence of some byte in this ByteString after or at some start index.intindexOf(byte elem, int from, int to) Finds index of first occurrence of some byte in this ByteString after or at some start index.<B> intindexOf(B elem, int from) booleanCheck whether this ByteString is compact in memory.iterator()Avoid `iterator` in performance sensitive code, call ops directly on ByteString insteadintlength()slice(int from, int until) take(int n) protected ObjectMethods inherited from class org.apache.pekko.util.ByteString
className, concat, contains, contains, copyToArray, createBuilder, dropWhile, empty, emptyByteString, foreach, fromArray, fromArray, fromArrayUnsafe, fromArrayUnsafe, fromByteBuffer, fromInts, fromInts, fromSpecific, fromString, fromString, fromString, getByteBuffers, grouped, head, indexOf, indexOfSlice, indexOfSlice, indexOfSlice, indexWhere, init, isEmpty, last, map, mapI, newBuilder, newSpecificBuilder, span, splitAt, startsWith, startsWith, tail, takeRight, takeWhile, toArray, toArray, toArrayUnsafe, toByteBuffer, toString, UTF_8, utf8StringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface scala.Function1
apply, apply$mcDD$sp, apply$mcDF$sp, apply$mcDI$sp, apply$mcDJ$sp, apply$mcFD$sp, apply$mcFF$sp, apply$mcFI$sp, apply$mcFJ$sp, apply$mcID$sp, apply$mcIF$sp, apply$mcII$sp, apply$mcIJ$sp, apply$mcJD$sp, apply$mcJF$sp, apply$mcJI$sp, apply$mcJJ$sp, apply$mcVD$sp, apply$mcVF$sp, apply$mcVI$sp, apply$mcVJ$sp, apply$mcZD$sp, apply$mcZF$sp, apply$mcZI$sp, apply$mcZJ$sp, composeMethods inherited from interface scala.collection.immutable.IndexedSeq
applyPreferredMaxLength, canEqual, iterableFactory, sameElements, toIndexedSeqMethods inherited from interface scala.collection.IndexedSeq
stringPrefixMethods inherited from interface scala.collection.IndexedSeqOps
foldRight, headOption, knownSize, lengthCompare, lengthCompare, map, prepended, reverse, reversed, reverseIterator, search, search, sliding, stepper, view, viewMethods inherited from interface scala.collection.Iterable
coll, collectionClassName, lazyZip, seq, toIterableMethods inherited from interface scala.collection.IterableOnceOps
$colon$bslash, $div$colon, addString, addString, addString, aggregate, collectFirst, copyToArray, copyToBuffer, corresponds, count, exists, find, fold, foldLeft, forall, hasDefiniteSize, max, maxBy, maxByOption, maxOption, min, minBy, minByOption, minOption, mkString, mkString, mkString, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, sum, to, toBuffer, toIterator, toList, toMap, toSet, toStream, toVectorMethods inherited from interface scala.collection.IterableOps
$plus$plus, companion, groupBy, groupMap, groupMapReduce, inits, isTraversableAgain, lastOption, repr, scan, scanRight, sizeIs, sliding, tails, toTraversable, transpose, withFilter, zipAllMethods inherited from interface scala.PartialFunction
andThen, andThen, applyOrElse, compose, elementWise, isDefinedAt, lift, orElse, runWith, unapplyMethods inherited from interface scala.collection.immutable.Seq
toSeqMethods inherited from interface scala.collection.Seq
equals, hashCodeMethods inherited from interface scala.collection.SeqOps
$colon$plus, $colon$plus$plus, $plus$colon, $plus$plus$colon, combinations, concat, containsSlice, corresponds, distinct, endsWith, findLast, indexOf, indexOfSlice, indexWhere, indices, isDefinedAt, lastIndexOf, lastIndexOf$default$2, lastIndexOfSlice, lastIndexOfSlice, lastIndexWhere, lastIndexWhere, lengthIs, occCounts, permutations, prefixLength, reverseMap, scala$collection$SeqOps$$toGenericSeq, segmentLength, segmentLength, size, sizeCompare, sizeCompare, sortBy, sortWith, startsWith, startsWith$default$2, unionMethods inherited from interface scala.collection.StrictOptimizedIterableOps
collect, filter, filterImpl, filterNot, flatMap, flatten, map, partition, partitionMap, scanLeft, strictOptimizedCollect, strictOptimizedConcat, strictOptimizedFlatMap, strictOptimizedFlatten, strictOptimizedMap, strictOptimizedZip, tapEach, unzip, unzip3, zip, zipWithIndexMethods inherited from interface scala.collection.immutable.StrictOptimizedSeqOps
distinctBy, patch, sorted, updatedMethods inherited from interface scala.collection.StrictOptimizedSeqOps
appended, appendedAll, diff, intersect, padTo, prepended, prependedAll
-
Constructor Details
-
ByteStrings
public ByteStrings()
-
-
Method Details
-
length
public int length() -
apply
public byte apply(int idx) - Specified by:
applyin interfacescala.collection.SeqOps<Object,scala.collection.Seq, scala.collection.Seq<Object>> - Specified by:
applyin classByteString
-
iterator
Avoid `iterator` in performance sensitive code, call ops directly on ByteString instead- Specified by:
iteratorin interfacescala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> - Specified by:
iteratorin interfacescala.collection.IterableOnce<Object>- Overrides:
iteratorin classByteString
-
$plus$plus
Description copied from class:ByteStringEfficiently concatenate another ByteString.- Specified by:
$plus$plusin classByteString
-
isCompact
public boolean isCompact()Description copied from class:ByteStringCheck whether this ByteString is compact in memory. If the ByteString is compact, it might, however, not be represented by an object that takes full advantage of that fact. Use compact to get such an object.- Specified by:
isCompactin classByteString
-
copyToBuffer
Description copied from class:ByteStringCopy as many bytes as possible to a ByteBuffer, starting from it's current position. This method will not overflow the buffer.- Specified by:
copyToBufferin classByteString- Parameters:
buffer- a ByteBuffer to copy bytes to- Returns:
- the number of bytes actually copied
-
compact
Description copied from class:ByteStringCreate a new ByteString with all contents compacted into a single, full byte array. If isCompact returns true, compact is an O(1) operation, but might return a different object with an optimized implementation.- Specified by:
compactin classByteString
-
asByteBuffer
Description copied from class:ByteStringReturns a read-only ByteBuffer that directly wraps this ByteString if it is not fragmented.- Specified by:
asByteBufferin classByteString
-
asByteBuffers
Description copied from class:ByteStringScala API: Returns an immutable Iterable of read-only ByteBuffers that directly wraps this ByteStrings all fragments. Will always have at least one entry.- Specified by:
asByteBuffersin classByteString
-
asInputStream
Description copied from class:ByteStringReturn the bytes in this ByteString as an InputStream.- Specified by:
asInputStreamin classByteString- Returns:
- the bytes in this ByteString accessible as an InputStream
- See Also:
-
decodeString
Description copied from class:ByteStringDecodes this ByteString using a charset to produce a String. If you have aCharsetinstance available, usedecodeString(charset: java.nio.charset.Charsetinstead.- Specified by:
decodeStringin classByteString
-
decodeString
Description copied from class:ByteStringDecodes this ByteString using a charset to produce a String. Avoids Charset.forName lookup in String internals, thus is preferable todecodeString(charset: String).- Specified by:
decodeStringin classByteString
-
decodeBase64
Description copied from class:ByteStringReturns a ByteString which is the binary representation of this ByteString if this ByteString is Base64-encoded.- Specified by:
decodeBase64in classByteString
-
encodeBase64
Description copied from class:ByteStringReturns a ByteString which is the Base64 representation of this ByteString- Specified by:
encodeBase64in classByteString
-
take
- Specified by:
takein interfacescala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> - Specified by:
takein interfacescala.collection.IterableOnceOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Specified by:
takein interfacescala.collection.IterableOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Overrides:
takein classByteString
-
dropRight
- Specified by:
dropRightin interfacescala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> - Specified by:
dropRightin interfacescala.collection.IterableOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Specified by:
dropRightin interfacescala.collection.StrictOptimizedIterableOps<Object,scala.collection.immutable.IndexedSeq, ByteString> - Overrides:
dropRightin classByteString
-
slice
- Specified by:
slicein interfacescala.collection.immutable.IndexedSeqOps<Object,scala.collection.immutable.IndexedSeq, scala.collection.immutable.IndexedSeq<Object>> - Specified by:
slicein interfacescala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> - Specified by:
slicein interfacescala.collection.IterableOnceOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Specified by:
slicein interfacescala.collection.IterableOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Overrides:
slicein classByteString
-
drop
- Specified by:
dropin interfacescala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq, scala.collection.IndexedSeq<Object>> - Specified by:
dropin interfacescala.collection.IterableOnceOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Specified by:
dropin interfacescala.collection.IterableOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Overrides:
dropin classByteString
-
indexOf
public <B> int indexOf(B elem, int from) - Specified by:
indexOfin interfacescala.collection.SeqOps<Object,scala.collection.Seq, scala.collection.Seq<Object>> - Overrides:
indexOfin classByteString
-
indexOf
public int indexOf(byte elem, int from) Description copied from class:ByteStringFinds index of first occurrence of some byte in this ByteString after or at some start index.Similar to Seq's indexOf, but it avoids boxing if the value is already a byte.
- Overrides:
indexOfin classByteString- Parameters:
elem- the element value to search for.from- the start index- Returns:
- the index
>= fromof the first element of this ByteString that is equal (as determined by==) toelem, or-1, if none exists.
-
indexOf
public int indexOf(byte elem, int from, int to) Description copied from class:ByteStringFinds index of first occurrence of some byte in this ByteString after or at some start index. This overload allows you to specify an end index (exclusive).- Specified by:
indexOfin classByteString- Parameters:
elem- the element value to search for.from- the start indexto- the end index (exclusive)- Returns:
- the index
>= fromand< toof the first element of this ByteString that is equal (as determined by==) toelem, or-1, if none exists.
-
copyToArray
- Specified by:
copyToArrayin interfacescala.collection.IterableOnceOps<Object,scala.collection.Iterable, scala.collection.Iterable> - Overrides:
copyToArrayin classByteString
-
writeReplace
-