ImmutableByteArray


@UnstableApi
class ImmutableByteArray


byte version of com.google.common.primitives.ImmutableIntArray.

This avoids the boxing/un-boxing costs of ImmutableList<Byte> and offers more ergonomic integration with APIs that expect a byte[].

Summary

Nested types

Builder for ImmutableByteArray instances.

Public functions

java-static ImmutableByteArray!

Returns an instance containing the concatenated contents of arrays.

java-static ByteArray<Byte>!

Returns a byte[] containing the concatenated contents of arrays.

java-static ImmutableByteArray!
copyOf(collection: (Mutable)Collection<Byte!>!)

Returns an instance backed by a copy of collection.

java-static ImmutableByteArray!
copyOf(values: ByteArray!)

Returns an instance backed by a copy of values.

Byte
get(i: Int)

Returns the byte at index i.

Boolean

Returns true if this array contains no elements.

Int

Returns the number of elements in this array.

java-static ImmutableByteArray!
of()

Returns an empty instance.

java-static ImmutableByteArray!
ofHexString(hexString: String!)

Returns an instance containing the bytes encoded in hexString.

java-static ImmutableByteArray!
ofUnsigned(value1: Long, otherValues: LongArray!)

Returns an instance containing the provided long values converted to byte with checkedCast.

ImmutableByteArray!
subArray(startIndex: Int, endIndex: Int)

Returns a new byte[] containing the elements from this instance between indexes startIndex (inclusive) and endIndex (exclusive).

ByteArray<Byte>!

Returns a new byte[] containing the same elements as this instance.

Public functions

concat

java-static fun concat(arrays: Array<ImmutableByteArray!>!): ImmutableByteArray!

Returns an instance containing the concatenated contents of arrays.

concatToArray

java-static fun concatToArray(arrays: Array<ImmutableByteArray!>!): ByteArray<Byte>!

Returns a byte[] containing the concatenated contents of arrays.

copyOf

java-static fun copyOf(collection: (Mutable)Collection<Byte!>!): ImmutableByteArray!

Returns an instance backed by a copy of collection.

copyOf

java-static fun copyOf(values: ByteArray!): ImmutableByteArray!

Returns an instance backed by a copy of values.

get

fun get(i: Int): Byte

Returns the byte at index i.

isEmpty

fun isEmpty(): Boolean

Returns true if this array contains no elements.

length

fun length(): Int

Returns the number of elements in this array.

of

java-static fun of(): ImmutableByteArray!

Returns an empty instance.

ofHexString

java-static fun ofHexString(hexString: String!): ImmutableByteArray!

Returns an instance containing the bytes encoded in hexString.

ofUnsigned

java-static fun ofUnsigned(value1: Long, otherValues: LongArray!): ImmutableByteArray!

Returns an instance containing the provided long values converted to byte with checkedCast.

subArray

fun subArray(startIndex: Int, endIndex: Int): ImmutableByteArray!

Returns a new byte[] containing the elements from this instance between indexes startIndex (inclusive) and endIndex (exclusive).

toArray

fun toArray(): ByteArray<Byte>!

Returns a new byte[] containing the same elements as this instance.