Package akka.util

Class ByteString$


  • public class ByteString$
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ByteString$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteString$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ByteString apply​(byte[] bytes)
      Creates a new ByteString by copying a byte array.
      ByteString apply​(java.lang.String string)
      Creates a new ByteString by encoding a String as UTF-8.
      ByteString apply​(java.lang.String string, java.lang.String charset)
      Creates a new ByteString by encoding a String with a charset.
      ByteString apply​(java.lang.String string, java.nio.charset.Charset charset)
      Creates a new ByteString by encoding a String with a charset.
      ByteString apply​(java.nio.ByteBuffer bytes)
      Creates a new ByteString by copying bytes from a ByteBuffer.
      ByteString apply​(scala.collection.immutable.Seq<java.lang.Object> bytes)
      Creates a new ByteString by copying bytes.
      <T> ByteString apply​(scala.collection.immutable.Seq<T> bytes, scala.math.Integral<T> num)
      Creates a new ByteString by converting from integral numbers to bytes.
      ByteString apply​(scala.collection.IterableOnce<java.lang.Object> bytes)
      Creates a new ByteString by iterating over bytes.
      ByteStringBuilder createBuilder()
      Java API
      ByteString empty()  
      ByteString emptyByteString()
      Java API
      ByteString fromArray​(byte[] array)
      Creates a new ByteString by copying a byte array.
      ByteString fromArray​(byte[] array, int offset, int length)
      Creates a new ByteString by copying length bytes starting at offset from an Array.
      ByteString fromArrayUnsafe​(byte[] array)
      Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.
      ByteString fromArrayUnsafe​(byte[] array, int offset, int length)
      Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.
      ByteString fromByteBuffer​(java.nio.ByteBuffer buffer)
      Creates a new ByteString by copying bytes out of a ByteBuffer.
      ByteString fromInts​(int... array)
      JAVA API Creates a new ByteString by copying an int array by converting from integral numbers to bytes.
      ByteString fromInts​(scala.collection.immutable.Seq<java.lang.Object> array)
      JAVA API Creates a new ByteString by copying an int array by converting from integral numbers to bytes.
      ByteString fromString​(java.lang.String string)
      Creates a new ByteString which will contain the UTF-8 representation of the given String
      ByteString fromString​(java.lang.String string, java.lang.String charset)
      Creates a new ByteString which will contain the representation of the given String in the given charset
      ByteString fromString​(java.lang.String string, java.nio.charset.Charset charset)
      Creates a new ByteString which will contain the representation of the given String in the given charset
      ByteStringBuilder newBuilder()  
      java.lang.String UTF_8()
      Standard "UTF-8" charset
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final ByteString$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • ByteString$

        public ByteString$()
    • Method Detail

      • fromInts

        public ByteString fromInts​(int... array)
        JAVA API Creates a new ByteString by copying an int array by converting from integral numbers to bytes.
      • apply

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

        public ByteString apply​(scala.collection.immutable.Seq<java.lang.Object> bytes)
        Creates a new ByteString by copying bytes.
      • apply

        public ByteString apply​(scala.collection.IterableOnce<java.lang.Object> bytes)
        Creates a new ByteString by iterating over bytes.
      • apply

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

        public ByteString apply​(java.nio.ByteBuffer bytes)
        Creates a new ByteString by copying bytes from a ByteBuffer.
      • apply

        public ByteString apply​(java.lang.String string)
        Creates a new ByteString by encoding a String as UTF-8.
      • apply

        public ByteString apply​(java.lang.String string,
                                java.lang.String charset)
        Creates a new ByteString by encoding a String with a charset.
      • apply

        public ByteString apply​(java.lang.String string,
                                java.nio.charset.Charset charset)
        Creates a new ByteString by encoding a String with a charset.
      • fromArray

        public ByteString fromArray​(byte[] array)
        Creates a new ByteString by copying a byte array.
      • fromArrayUnsafe

        public ByteString fromArrayUnsafe​(byte[] array)
        Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.

        Creates a ByteString without copying the passed in byte array, unlike other factory methods defined on ByteString. This method of creating a ByteString saves one array copy and allocation and therefore can lead to better performance, however it also means that one MUST NOT modify the passed in array, or unexpected immutable data structure contract-breaking behavior will manifest itself.

        This API is intended for users who have obtained an byte array from some other API, and want wrap it into an ByteArray, and from there on only use that reference (the ByteString) to operate on the wrapped data. For all other intents and purposes, please use the usual apply and create methods - which provide the immutability guarantees by copying the array.

      • fromArray

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

        public ByteString fromArrayUnsafe​(byte[] array,
                                          int offset,
                                          int length)
        Unsafe API: Use only in situations you are completely confident that this is what you need, and that you understand the implications documented below.

        Creates a ByteString without copying the passed in byte array, unlike other factory methods defined on ByteString. This method of creating a ByteString saves one array copy and allocation and therefore can lead to better performance, however it also means that one MUST NOT modify the passed in array, or unexpected immutable data structure contract-breaking behavior will manifest itself.

        This API is intended for users who have obtained an byte array from some other API, and want wrap it into an ByteArray, and from there on only use that reference (the ByteString) to operate on the wrapped data. For all other intents and purposes, please use the usual apply and create methods - which provide the immutability guarantees by copying the array.

      • fromInts

        public ByteString fromInts​(scala.collection.immutable.Seq<java.lang.Object> array)
        JAVA API Creates a new ByteString by copying an int array by converting from integral numbers to bytes.
      • fromString

        public ByteString fromString​(java.lang.String string)
        Creates a new ByteString which will contain the UTF-8 representation of the given String
      • fromString

        public ByteString fromString​(java.lang.String string,
                                     java.lang.String charset)
        Creates a new ByteString which will contain the representation of the given String in the given charset
      • fromString

        public ByteString fromString​(java.lang.String string,
                                     java.nio.charset.Charset charset)
        Creates a new ByteString which will contain the representation of the given String in the given charset
      • UTF_8

        public java.lang.String UTF_8()
        Standard "UTF-8" charset
      • fromByteBuffer

        public ByteString fromByteBuffer​(java.nio.ByteBuffer buffer)
        Creates a new ByteString by copying bytes out of a ByteBuffer.
      • emptyByteString

        public ByteString emptyByteString()
        Java API