public final class ByteVector extends Object
Modifier and Type | Method and Description |
---|---|
static ByteVector |
copyFrom(byte[] bytes)
Creates a new byte vectory from a copy of
bytes . |
byte[] |
copyToNewArray()
Copy the contents of this byte vector to a freshly allocated new array.
|
boolean |
equals(Object o)
Returns
true iff o is a byte vector with contents identical
to this byte vector. |
byte |
get(int index)
Returns the
index -th element of the byte vector. |
int |
hashCode() |
int |
size()
Returns the length of the byte vector (i.e., the length of the underlying array).
|
static ByteVector |
wrap(byte[] bytes)
Wraps the byte array
bytes into a byte vector. |
public static ByteVector wrap(byte[] bytes)
bytes
into a byte vector.
Note that the byte vector will be backed by bytes
, so any changes
of the contents of bytes
will be reflected in the resulting byte vector.
bytes
- the byte array, must not be null
bytes
NullPointerException
- if bytes
is null
public static ByteVector copyFrom(byte[] bytes)
bytes
.bytes
- the byte array, must not be null
bytes
NullPointerException
- if bytes
is null
public boolean equals(Object o)
true
iff o
is a byte vector with contents identical
to this byte vector.public int size()
public byte get(int index)
index
-th element of the byte vector.index
- the index, must be in the range between 0 (inclusive) and size()
(exclusive)index
-th element of this byte vectorArrayIndexOutOfBoundsException
- if index
is outside of the permitted
rangepublic byte[] copyToNewArray()
Copyright © 2016. All rights reserved.