Packages

object ByteVector extends ByteVectorCompanionCrossPlatform with Serializable

Companion for ByteVector.

Source
ByteVector.scala
Linear Supertypes
Serializable, ByteVectorCompanionCrossPlatform, ByteVectorPlatform, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ByteVector
  2. Serializable
  3. ByteVectorCompanionCrossPlatform
  4. ByteVectorPlatform
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. implicit final class GroupedOp extends AnyVal

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(bs: IterableOnce[Byte]): ByteVector

    Constructs a ByteVector from a scala.collection source of bytes.

  5. def apply(buffer: ByteBuffer): ByteVector

    Constructs a ByteVector from a ByteBuffer.

    Constructs a ByteVector from a ByteBuffer. The given ByteBuffer is is copied to ensure the resulting ByteVector is immutable. If this is not desired, use ByteVector.view.

    The returned vector is a copy of a subsequence of the buffer, with bounds determined by the buffer's position and limit at the time this method is called.

  6. def apply(bytes: Array[Byte], offset: Int, length: Int): ByteVector

    Constructs a ByteVector from an Array[Byte], an offset, and a length.

    Constructs a ByteVector from an Array[Byte], an offset, and a length. The given Array[Byte] is copied to ensure the resulting ByteVector is immutable. If this is not desired, use ByteVector.view.

  7. def apply(bytes: Array[Byte]): ByteVector

    Constructs a ByteVector from an Array[Byte].

    Constructs a ByteVector from an Array[Byte]. The given Array[Byte] is copied to ensure the resulting ByteVector is immutable. If this is not desired, use ByteVector.view.

  8. def apply(bytes: Vector[Byte]): ByteVector

    Constructs a ByteVector from a collection of bytes.

  9. def apply[A](bytes: A*)(implicit arg0: Integral[A]): ByteVector

    Constructs a ByteVector from a list of literal bytes.

    Constructs a ByteVector from a list of literal bytes. Only the least significant byte is used of each integral value.

  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  12. def concat(bvs: IterableOnce[ByteVector]): ByteVector

    Concatenates all the given ByteVectors into a single instance.

  13. val empty: ByteVector

    Empty byte vector.

  14. def encodeAscii(str: String): Either[CharacterCodingException, ByteVector]

    Encodes the specified string to a ByteVector using the US-ASCII charset.

  15. def encodeString(str: String)(implicit charset: Charset): Either[CharacterCodingException, ByteVector]

    Encodes the specified string to a ByteVector using the implicitly available Charset.

  16. def encodeUtf8(str: String): Either[CharacterCodingException, ByteVector]

    Encodes the specified string to a ByteVector using the UTF-8 charset.

  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. def fill[A](size: Long)(b: A)(implicit arg0: Integral[A]): ByteVector

    Constructs a ByteVector of the given size, where all bytes have the value b.

  20. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  21. def fromBase32(str: String, alphabet: Base32Alphabet = Bases.Alphabets.Base32): Option[ByteVector]

    Constructs a ByteVector from a base 64 string or returns None if the string is not valid base 32.

    Constructs a ByteVector from a base 64 string or returns None if the string is not valid base 32. Details pertaining to base 32 decoding can be found in the comment for fromBase32Descriptive. The string may contain whitespace characters which are ignored.

  22. def fromBase32Descriptive(str: String, alphabet: Base32Alphabet = Bases.Alphabets.Base32): Either[String, ByteVector]

    Constructs a ByteVector from a base 32 string or returns an error message if the string is not valid base 32.

    Constructs a ByteVector from a base 32 string or returns an error message if the string is not valid base 32. An empty input string results in an empty ByteVector. The string may contain whitespace characters and hyphens which are ignored.

  23. def fromBase58(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): Option[ByteVector]

    Constructs a ByteVector from a base 58 string or returns None if the string is not valid base 58.

    Constructs a ByteVector from a base 58 string or returns None if the string is not valid base 58. Details pertaining to base 58 decoding can be found in the comment for fromBase58Descriptive. The string may contain whitespace characters which are ignored.

  24. def fromBase58Descriptive(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): Either[String, ByteVector]

    Constructs a ByteVector from a base 58 string or returns an error message if the string is not valid base 58.

    Constructs a ByteVector from a base 58 string or returns an error message if the string is not valid base 58. It is similar to Base64 but has been modified to avoid both non-alphanumeric characters and letters which might look ambiguous when printed. It is therefore designed for human users who manually enter the data, copying from some visual source Compared to Base64, the following similar-looking letters are omitted: 0 (zero), O (capital o), I (capital i) and l (lower case L) as well as the non-alphanumeric characters + (plus) and / (slash). The actual order of letters in the alphabet depends on the application, the default order is the same used in Bitcoin An empty input string results in an empty ByteVector. The string may contain whitespace characters which are ignored.

  25. def fromBase64(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): Option[ByteVector]

    Constructs a ByteVector from a base 64 string or returns None if the string is not valid base 64.

    Constructs a ByteVector from a base 64 string or returns None if the string is not valid base 64. Details pertaining to base 64 decoding can be found in the comment for fromBase64Descriptive. The string may contain whitespace characters which are ignored.

  26. def fromBase64Descriptive(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): Either[String, ByteVector]

    Constructs a ByteVector from a base 64 string or returns an error message if the string is not valid base 64.

    Constructs a ByteVector from a base 64 string or returns an error message if the string is not valid base 64. If the final encoding quantum does not contain 4 characters, i.e. the total number of characters is not evenly divisible by 4, padding is inferred if the final quantum contains 2 or 3 characters. This is to say that padding is optional as long as the inferred padding would yield a valid base 64 string. The input is considered invalid if the final quantum only contains a single character. If padding characters are present, they must be used in accordance with the base 64 specification and no padding characters will be inferred. An empty input string results in an empty ByteVector. The string may contain whitespace characters which are ignored.

  27. def fromBin(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): Option[ByteVector]

    Constructs a ByteVector from a binary string or returns None if the string is not valid binary.

    Constructs a ByteVector from a binary string or returns None if the string is not valid binary.

    The string may start with a 0b and it may contain whitespace or underscore characters.

  28. def fromBinDescriptive(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): Either[String, ByteVector]

    Constructs a ByteVector from a binary string or returns an error message if the string is not valid binary.

    Constructs a ByteVector from a binary string or returns an error message if the string is not valid binary.

    The string may start with a 0b and it may contain whitespace or underscore characters.

  29. def fromByte(b: Byte): ByteVector

    Constructs a ByteVector vector with the 2's complement encoding of the specified byte.

    Constructs a ByteVector vector with the 2's complement encoding of the specified byte.

    b

    value to encode

  30. def fromHex(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): Option[ByteVector]

    Constructs a ByteVector from a hexadecimal string or returns None if the string is not valid hexadecimal.

    Constructs a ByteVector from a hexadecimal string or returns None if the string is not valid hexadecimal.

    The string may start with a 0x and it may contain whitespace or underscore characters.

  31. def fromHexDescriptive(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): Either[String, ByteVector]

    Constructs a ByteVector from a hexadecimal string or returns an error message if the string is not valid hexadecimal.

    Constructs a ByteVector from a hexadecimal string or returns an error message if the string is not valid hexadecimal.

    The string may start with a 0x and it may contain whitespace or underscore characters.

  32. def fromInt(i: Int, size: Int = 4, ordering: ByteOrdering = ByteOrdering.BigEndian): ByteVector

    Constructs a ByteVector with the 2's complement encoding of the specified value.

    Constructs a ByteVector with the 2's complement encoding of the specified value.

    i

    value to encode

    size

    size of vector (<= 4)

    ordering

    byte ordering of vector

  33. def fromLong(l: Long, size: Int = 8, ordering: ByteOrdering = ByteOrdering.BigEndian): ByteVector

    Constructs a ByteVector with the 2's complement encoding of the specified value.

    Constructs a ByteVector with the 2's complement encoding of the specified value.

    l

    value to encode

    size

    size of vector (<= 8)

    ordering

    byte ordering of vector

  34. def fromShort(s: Short, size: Int = 2, ordering: ByteOrdering = ByteOrdering.BigEndian): ByteVector

    Constructs a ByteVector vector with the 2's complement encoding of the specified value.

    Constructs a ByteVector vector with the 2's complement encoding of the specified value.

    s

    value to encode

    size

    size of vector (<= 2)

    ordering

    byte ordering of vector

  35. final def fromUUID(u: UUID): ByteVector

    Constructs a ByteVector containing the binary representation of the specified UUID.

    Constructs a ByteVector containing the binary representation of the specified UUID. The bytes are in MSB-to-LSB order.

    u

    value to encode

  36. def fromValidBase32(str: String, alphabet: Base32Alphabet = Bases.Alphabets.Base32): ByteVector

    Constructs a ByteVector from a base 32 string or throws an IllegalArgumentException if the string is not valid base 32.

    Constructs a ByteVector from a base 32 string or throws an IllegalArgumentException if the string is not valid base 32. Details pertaining to base 32 decoding can be found in the comment for fromBase32Descriptive. The string may contain whitespace characters which are ignored.

    Exceptions thrown

    IllegalArgumentException if the string is not valid base 32

  37. def fromValidBase58(str: String, alphabet: Alphabet = Bases.Alphabets.Base58): ByteVector

    Constructs a ByteVector from a base 58 string or throws an IllegalArgumentException if the string is not valid base 58.

    Constructs a ByteVector from a base 58 string or throws an IllegalArgumentException if the string is not valid base 58. Details pertaining to base 58 decoding can be found in the comment for fromBase58Descriptive. The string may contain whitespace characters which are ignored.

    Exceptions thrown

    IllegalArgumentException if the string is not valid base 58

  38. def fromValidBase64(str: String, alphabet: Base64Alphabet = Bases.Alphabets.Base64): ByteVector

    Constructs a ByteVector from a base 64 string or throws an IllegalArgumentException if the string is not valid base 64.

    Constructs a ByteVector from a base 64 string or throws an IllegalArgumentException if the string is not valid base 64. Details pertaining to base 64 decoding can be found in the comment for fromBase64Descriptive. The string may contain whitespace characters which are ignored.

    Exceptions thrown

    IllegalArgumentException if the string is not valid base 64

  39. def fromValidBin(str: String, alphabet: BinaryAlphabet = Bases.Alphabets.Binary): ByteVector

    Constructs a ByteVector from a binary string or throws an IllegalArgumentException if the string is not valid binary.

    Constructs a ByteVector from a binary string or throws an IllegalArgumentException if the string is not valid binary.

    The string may start with a 0b and it may contain whitespace or underscore characters.

    Exceptions thrown

    IllegalArgumentException if the string is not valid binary

  40. def fromValidHex(str: String, alphabet: HexAlphabet = Bases.Alphabets.HexLowercase): ByteVector

    Constructs a ByteVector from a hexadecimal string or throws an IllegalArgumentException if the string is not valid hexadecimal.

    Constructs a ByteVector from a hexadecimal string or throws an IllegalArgumentException if the string is not valid hexadecimal.

    The string may start with a 0x and it may contain whitespace or underscore characters.

    Exceptions thrown

    IllegalArgumentException if the string is not valid hexadecimal

  41. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  42. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  43. def high(size: Long): ByteVector

    Constructs a ByteVector of the given size, where all bytes have the value 0xff.

  44. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  45. def low(size: Long): ByteVector

    Constructs a ByteVector of the given size, where all bytes have the value 0.

  46. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  47. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  48. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  49. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  50. def toString(): String
    Definition Classes
    AnyRef → Any
  51. def unapplySeq(b: ByteVector): Some[Seq[Byte]]

    Extractor used in support of pattern matching on the bytes of a vector.

  52. def view(bytes: ByteBuffer): ByteVector

    Constructs a ByteVector from a ByteBuffer.

    Constructs a ByteVector from a ByteBuffer. Unlike apply, this does not make a copy of the input buffer, so callers should take care not to modify the contents of the buffer passed to this function.

    The returned vector is a view of a subsequence of the buffer, with bounds determined by the buffer's position and limit at the time this method is called.

  53. def view(bytes: Array[Byte], offset: Int, size: Int): ByteVector

    Constructs a ByteVector from a slice of an Array[Byte].

    Constructs a ByteVector from a slice of an Array[Byte]. Unlike apply, this does not make a copy of the input array, so callers should take care not to modify the contents of the array passed to this function.

  54. def view(bytes: Array[Byte]): ByteVector

    Constructs a ByteVector from an Array[Byte].

    Constructs a ByteVector from an Array[Byte]. Unlike apply, this does not make a copy of the input array, so callers should take care not to modify the contents of the array passed to this function.

  55. def viewAt(at: (Long) => Byte, size: Long): ByteVector

    Constructs a ByteVector from a function from Long => Byte and a size.

  56. def viewI(at: (Long) => Int, size: Long): ByteVector

    Constructs a ByteVector from a function from Long => Int and a size, where the Int returned by at must fit in a Byte.

  57. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  58. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  59. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from ByteVectorCompanionCrossPlatform

Inherited from ByteVectorPlatform

Inherited from AnyRef

Inherited from Any

Constants

conversions

Constructors

Numeric Conversions

Base Conversions

Ungrouped