ImmutableByteArray
@UnstableApi
public final 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 |
|---|
public final class ImmutableByteArray.BuilderBuilder for |
Public methods |
|
|---|---|
static ImmutableByteArray |
concat(ImmutableByteArray[] arrays)Returns an instance containing the concatenated contents of |
static byte[] |
concatToArray(ImmutableByteArray[] arrays)Returns a |
static ImmutableByteArray |
copyOf(Collection<Byte> collection)Returns an instance backed by a copy of |
static ImmutableByteArray |
copyOf(byte[] values)Returns an instance backed by a copy of |
boolean |
|
byte |
get(int i)Returns the |
int |
hashCode() |
boolean |
isEmpty()Returns true if this array contains no elements. |
int |
length()Returns the number of elements in this array. |
static ImmutableByteArray |
of()Returns an empty instance. |
static ImmutableByteArray |
ofHexString(String hexString)Returns an instance containing the bytes encoded in |
static ImmutableByteArray |
ofUnsigned(long value1, long[] otherValues)Returns an instance containing the provided |
ImmutableByteArray |
subArray(int startIndex, int endIndex)Returns a new |
byte[] |
toArray()Returns a new |
String |
toString() |
Public methods
concat
public static ImmutableByteArray concat(ImmutableByteArray[] arrays)
Returns an instance containing the concatenated contents of arrays.
concatToArray
public static byte[] concatToArray(ImmutableByteArray[] arrays)
Returns a byte[] containing the concatenated contents of arrays.
copyOf
public static ImmutableByteArray copyOf(Collection<Byte> collection)
Returns an instance backed by a copy of collection.
copyOf
public static ImmutableByteArray copyOf(byte[] values)
Returns an instance backed by a copy of values.
ofHexString
public static ImmutableByteArray ofHexString(String hexString)
Returns an instance containing the bytes encoded in hexString.
ofUnsigned
public static ImmutableByteArray ofUnsigned(long value1, long[] otherValues)
Returns an instance containing the provided long values converted to byte with checkedCast.
subArray
public ImmutableByteArray subArray(int startIndex, int endIndex)
Returns a new byte[] containing the elements from this instance between indexes
startIndex (inclusive) and endIndex (exclusive).