@Immutable public final class Bytes extends Object
Wrap a bytearray so it prevents callers from modifying its contents. It does this by making a copy upon initialization, and also makes a copy if the underlying bytes are requested.
| Modifier and Type | Method and Description |
|---|---|
static Bytes |
copyFrom(byte[] data) |
static Bytes |
copyFrom(byte[] data,
int start,
int len)
Wrap an immutable byte array over a slice of a Bytes
|
boolean |
equals(Object o) |
int |
hashCode() |
int |
size() |
byte[] |
toByteArray() |
String |
toString() |
public static Bytes copyFrom(byte[] data)
data - the byte array to be wrapped.public static Bytes copyFrom(byte[] data, int start, int len)
data - the byte array to be wrapped.start - the starting index of the slicelen - the length of the slice. start + len must be less than the length of the array.start to start +
lenpublic byte[] toByteArray()
public int size()