Class ByteString.ByteString1C

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

public static final class ByteString.ByteString1C extends CompactByteString
A compact (unsliced) and unfragmented ByteString, implementation of ByteString1C.
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
    Efficiently concatenate another ByteString.
    byte
    apply(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.
    <B> int
    copyToArray(Object dest, int start, int len)
     
    int
    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.
    Decodes this ByteString using a charset to produce a String.
    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 ByteString
    int
    indexOf(byte elem, int from)
    Finds index of first occurrence of some byte in this ByteString after or at some start index.
    int
    indexOf(byte elem, int from, int to)
    Finds index of first occurrence of some byte in this ByteString after or at some start index.
    <B> int
    indexOf(B elem, int from)
     
     
    int
     
    slice(int from, int until)
     
    take(int n)
     
    byte[]
    Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.

    Methods inherited from class org.apache.pekko.util.CompactByteString

    apply, apply, apply, apply, apply, apply, apply, apply, compact, empty, fromArray, isCompact

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

    • ByteString1C

      public ByteString1C()
  • Method Details

    • apply

      public byte apply(int idx)
      Specified by:
      apply in interface scala.collection.SeqOps<Object,scala.collection.Seq,scala.collection.Seq<Object>>
      Specified by:
      apply in class ByteString
    • length

      public int length()
    • iterator

      public ByteIterator.ByteArrayIterator iterator()
      Specified by:
      iterator in interface scala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq,scala.collection.IndexedSeq<Object>>
      Specified by:
      iterator in interface scala.collection.IterableOnce<Object>
      Overrides:
      iterator in class ByteString
    • asByteBuffer

      public ByteBuffer asByteBuffer()
      Description copied from class: ByteString
      Returns a read-only ByteBuffer that directly wraps this ByteString if it is not fragmented.
      Specified by:
      asByteBuffer in class ByteString
    • asByteBuffers

      public scala.collection.immutable.Iterable<ByteBuffer> asByteBuffers()
      Description copied from class: ByteString
      Scala 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:
      asByteBuffers in class ByteString
    • decodeString

      public String decodeString(String charset)
      Description copied from class: ByteString
      Decodes this ByteString using a charset to produce a String. If you have a Charset instance available, use decodeString(charset: java.nio.charset.Charset instead.
      Specified by:
      decodeString in class ByteString
    • decodeString

      public String decodeString(Charset charset)
      Description copied from class: ByteString
      Decodes this ByteString using a charset to produce a String. Avoids Charset.forName lookup in String internals, thus is preferable to decodeString(charset: String).
      Specified by:
      decodeString in class ByteString
    • decodeBase64

      public ByteString decodeBase64()
      Description copied from class: ByteString
      Returns a ByteString which is the binary representation of this ByteString if this ByteString is Base64-encoded.
      Specified by:
      decodeBase64 in class ByteString
    • encodeBase64

      public ByteString encodeBase64()
      Description copied from class: ByteString
      Returns a ByteString which is the Base64 representation of this ByteString
      Specified by:
      encodeBase64 in class ByteString
    • $plus$plus

      public ByteString $plus$plus(ByteString that)
      Description copied from class: ByteString
      Efficiently concatenate another ByteString.
      Specified by:
      $plus$plus in class ByteString
    • take

      public ByteString take(int n)
      Specified by:
      take in interface scala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq,scala.collection.IndexedSeq<Object>>
      Specified by:
      take in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Specified by:
      take in interface scala.collection.IterableOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Overrides:
      take in class ByteString
    • dropRight

      public ByteString dropRight(int n)
      Specified by:
      dropRight in interface scala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq,scala.collection.IndexedSeq<Object>>
      Specified by:
      dropRight in interface scala.collection.IterableOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Specified by:
      dropRight in interface scala.collection.StrictOptimizedIterableOps<Object,scala.collection.immutable.IndexedSeq,ByteString>
      Overrides:
      dropRight in class ByteString
    • drop

      public ByteString drop(int n)
      Specified by:
      drop in interface scala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq,scala.collection.IndexedSeq<Object>>
      Specified by:
      drop in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Specified by:
      drop in interface scala.collection.IterableOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Overrides:
      drop in class ByteString
    • indexOf

      public <B> int indexOf(B elem, int from)
      Specified by:
      indexOf in interface scala.collection.SeqOps<Object,scala.collection.Seq,scala.collection.Seq<Object>>
      Overrides:
      indexOf in class ByteString
    • indexOf

      public int indexOf(byte elem, int from)
      Description copied from class: ByteString
      Finds 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:
      indexOf in class ByteString
      Parameters:
      elem - the element value to search for.
      from - the start index
      Returns:
      the index >= from of the first element of this ByteString that is equal (as determined by ==) to elem, or -1, if none exists.
    • indexOf

      public int indexOf(byte elem, int from, int to)
      Description copied from class: ByteString
      Finds 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:
      indexOf in class ByteString
      Parameters:
      elem - the element value to search for.
      from - the start index
      to - the end index (exclusive)
      Returns:
      the index >= from and < to of the first element of this ByteString that is equal (as determined by ==) to elem, or -1, if none exists.
    • slice

      public ByteString slice(int from, int until)
      Specified by:
      slice in interface scala.collection.immutable.IndexedSeqOps<Object,scala.collection.immutable.IndexedSeq,scala.collection.immutable.IndexedSeq<Object>>
      Specified by:
      slice in interface scala.collection.IndexedSeqOps<Object,scala.collection.IndexedSeq,scala.collection.IndexedSeq<Object>>
      Specified by:
      slice in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Specified by:
      slice in interface scala.collection.IterableOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Overrides:
      slice in class ByteString
    • copyToBuffer

      public int copyToBuffer(ByteBuffer buffer)
      Description copied from class: ByteString
      Copy as many bytes as possible to a ByteBuffer, starting from it's current position. This method will not overflow the buffer.

      Specified by:
      copyToBuffer in class ByteString
      Parameters:
      buffer - a ByteBuffer to copy bytes to
      Returns:
      the number of bytes actually copied
    • copyToArray

      public <B> int copyToArray(Object dest, int start, int len)
      Specified by:
      copyToArray in interface scala.collection.IterableOnceOps<Object,scala.collection.Iterable,scala.collection.Iterable>
      Overrides:
      copyToArray in class ByteString
    • toArrayUnsafe

      public byte[] toArrayUnsafe()
      Description copied from class: ByteString
      Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.

      If the ByteString is backed by a single array it is returned without any copy. If it is backed by a rope of multiple ByteString instances a new array will be allocated and the contents will be copied into it before returning it.

      This method of exposing the bytes of a ByteString can save one array copy and allocation in the happy path scenario which can lead to better performance, however it also means that one MUST NOT modify the returned array, or unexpected immutable data structure contract-breaking behavior will manifest itself.

      This API is intended for users who need to pass the byte array to some other API, which will only read the bytes and never mutate then. For all other intents and purposes, please use the usual toArray method - which provide the immutability guarantees by copying the backing array.

      Overrides:
      toArrayUnsafe in class ByteString
    • asInputStream

      public InputStream asInputStream()
      Description copied from class: ByteString
      Return the bytes in this ByteString as an InputStream.

      Specified by:
      asInputStream in class ByteString
      Returns:
      the bytes in this ByteString accessible as an InputStream
      See Also: