Class CompactByteString

java.lang.Object
org.apache.pekko.util.ByteString
org.apache.pekko.util.CompactByteString
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>
Direct Known Subclasses:
ByteString.ByteString1C

public abstract class CompactByteString extends ByteString implements Serializable
A compact ByteString.

The ByteString is guarantied to be contiguous in memory and to use only as much memory as required for its contents.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface scala.Function1

    scala.Function1.UnliftOps<A extends Object,B extends Object>, scala.Function1.UnliftOps$

    Nested classes/interfaces inherited from interface scala.collection.IterableOps

    scala.collection.IterableOps.SizeCompareOps, scala.collection.IterableOps.SizeCompareOps$, scala.collection.IterableOps.WithFilter<A extends Object,CC extends Object>

    Nested classes/interfaces inherited from interface scala.PartialFunction

    scala.PartialFunction.ElementWiseExtractor<A extends Object,B extends Object>, scala.PartialFunction.ElementWiseExtractor$
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(byte[] bytes)
    Creates a new CompactByteString by copying a byte array.
    apply(String string)
    Creates a new CompactByteString by encoding a String as UTF-8.
    apply(String string, String charset)
    Creates a new CompactByteString by encoding a String with a charset.
    apply(String string, Charset charset)
    Creates a new CompactByteString by encoding a String with a charset.
    Creates a new CompactByteString by copying bytes from a ByteBuffer.
    apply(scala.collection.immutable.Seq<Object> bytes)
    Creates a new CompactByteString by copying bytes.
    static <T> CompactByteString
    apply(scala.collection.immutable.Seq<T> bytes, scala.math.Integral<T> num)
    Creates a new CompactByteString by converting from integral numbers to bytes.
    apply(scala.collection.IterableOnce<Object> bytes)
    Creates a new CompactByteString by traversing bytes.
    Create a new ByteString with all contents compacted into a single, full byte array.
     
    fromArray(byte[] array, int offset, int length)
    Creates a new CompactByteString by copying length bytes starting at offset from an Array.
    boolean
    Check whether this ByteString is compact in memory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods 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, compose

    Methods inherited from interface scala.collection.immutable.IndexedSeq

    applyPreferredMaxLength, canEqual, iterableFactory, sameElements, toIndexedSeq

    Methods inherited from interface scala.collection.IndexedSeq

    stringPrefix

    Methods inherited from interface scala.collection.IndexedSeqOps

    foldRight, headOption, knownSize, lengthCompare, lengthCompare, map, prepended, reverse, reversed, reverseIterator, search, search, sliding, stepper, view, view

    Methods inherited from interface scala.collection.Iterable

    coll, collectionClassName, lazyZip, seq, toIterable

    Methods 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, toVector

    Methods inherited from interface scala.collection.IterableOps

    $plus$plus, companion, groupBy, groupMap, groupMapReduce, inits, isTraversableAgain, lastOption, repr, scan, scanRight, sizeIs, sliding, tails, toTraversable, transpose, withFilter, zipAll

    Methods inherited from interface scala.PartialFunction

    andThen, andThen, applyOrElse, compose, elementWise, isDefinedAt, lift, orElse, runWith, unapply

    Methods inherited from interface scala.collection.immutable.Seq

    toSeq

    Methods inherited from interface scala.collection.Seq

    equals, hashCode

    Methods 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, indexOfSlice, indexWhere, indices, isDefinedAt, lastIndexOf, lastIndexOf$default$2, lastIndexOfSlice, lastIndexOfSlice, lastIndexWhere, lastIndexWhere, length, lengthIs, occCounts, permutations, prefixLength, reverseMap, scala$collection$SeqOps$$toGenericSeq, segmentLength, segmentLength, size, sizeCompare, sizeCompare, sortBy, sortWith, startsWith, startsWith$default$2, union

    Methods 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, zipWithIndex

    Methods inherited from interface scala.collection.immutable.StrictOptimizedSeqOps

    distinctBy, patch, sorted, updated

    Methods inherited from interface scala.collection.StrictOptimizedSeqOps

    appended, appendedAll, diff, intersect, padTo, prepended, prependedAll
  • Constructor Details

    • CompactByteString

      public CompactByteString()
  • Method Details

    • apply

      public static CompactByteString apply(byte[] bytes)
      Creates a new CompactByteString by copying a byte array.
    • apply

      public static CompactByteString apply(scala.collection.immutable.Seq<Object> bytes)
      Creates a new CompactByteString by copying bytes.
    • apply

      public static CompactByteString apply(scala.collection.IterableOnce<Object> bytes)
      Creates a new CompactByteString by traversing bytes.
    • apply

      public static <T> CompactByteString apply(scala.collection.immutable.Seq<T> bytes, scala.math.Integral<T> num)
      Creates a new CompactByteString by converting from integral numbers to bytes.
    • apply

      public static CompactByteString apply(ByteBuffer bytes)
      Creates a new CompactByteString by copying bytes from a ByteBuffer.
    • apply

      public static CompactByteString apply(String string)
      Creates a new CompactByteString by encoding a String as UTF-8.
    • apply

      public static CompactByteString apply(String string, String charset)
      Creates a new CompactByteString by encoding a String with a charset.
    • apply

      public static CompactByteString apply(String string, Charset charset)
      Creates a new CompactByteString by encoding a String with a charset.
    • fromArray

      public static CompactByteString fromArray(byte[] array, int offset, int length)
      Creates a new CompactByteString by copying length bytes starting at offset from an Array.
    • empty

      public static CompactByteString empty()
    • isCompact

      public boolean isCompact()
      Description copied from class: ByteString
      Check 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:
      isCompact in class ByteString
    • compact

      public CompactByteString compact()
      Description copied from class: ByteString
      Create 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:
      compact in class ByteString