public class ByteArray
extends java.lang.Object
构造器和说明 |
---|
ByteArray()
Creates an ordered array with a capacity of 16.
|
ByteArray(boolean ordered,
byte[] array,
int startIndex,
int count)
Creates a new array containing the elements in the specified array.
|
ByteArray(boolean ordered,
int capacity) |
ByteArray(byte[] array)
Creates a new ordered array containing the elements in the specified array.
|
ByteArray(ByteArray array)
Creates a new array containing the elements in the specific array.
|
ByteArray(int capacity)
Creates an ordered array with the specified capacity.
|
限定符和类型 | 方法和说明 |
---|---|
void |
add(byte value) |
void |
addAll(byte... array) |
void |
addAll(byte[] array,
int offset,
int length) |
void |
addAll(ByteArray array) |
void |
addAll(ByteArray array,
int offset,
int length) |
void |
clear() |
boolean |
contains(byte value) |
byte[] |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object object) |
byte |
first()
Returns the first item.
|
byte |
get(int index) |
int |
hashCode() |
void |
incr(int index,
byte value) |
int |
indexOf(byte value) |
void |
insert(int index,
byte value) |
int |
lastIndexOf(byte value) |
void |
mul(int index,
byte value) |
byte |
peek()
Returns the last item.
|
byte |
pop()
Removes and returns the last item.
|
byte |
random()
Returns a random item from the array, or zero if the array is empty.
|
boolean |
removeAll(ByteArray array)
Removes from this array all of elements contained in the specified array.
|
int |
removeIndex(int index)
Removes and returns the item at the specified index.
|
void |
removeRange(int start,
int end)
Removes the items between the specified indices, inclusive.
|
boolean |
removeValue(byte value) |
protected byte[] |
resize(int newSize) |
void |
reverse() |
void |
set(int index,
byte value) |
byte[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size undefined.
|
byte[] |
shrink()
Reduces the size of the backing array to the size of the actual items.
|
void |
shuffle() |
void |
sort() |
void |
swap(int first,
int second) |
byte[] |
toArray() |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
void |
truncate(int newSize)
Reduces the size of the array to the specified size.
|
static ByteArray |
with(byte... array) |
public ByteArray()
public ByteArray(int capacity)
public ByteArray(boolean ordered, int capacity)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.capacity
- Any elements added beyond this will cause the backing array to be grown.public ByteArray(ByteArray array)
public ByteArray(byte[] array)
public ByteArray(boolean ordered, byte[] array, int startIndex, int count)
ordered
- If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy.public void add(byte value)
public void addAll(ByteArray array)
public void addAll(ByteArray array, int offset, int length)
public void addAll(byte... array)
public void addAll(byte[] array, int offset, int length)
public byte get(int index)
public void set(int index, byte value)
public void incr(int index, byte value)
public void mul(int index, byte value)
public void insert(int index, byte value)
public void swap(int first, int second)
public boolean contains(byte value)
public int indexOf(byte value)
public int lastIndexOf(byte value)
public boolean removeValue(byte value)
public int removeIndex(int index)
public void removeRange(int start, int end)
public boolean removeAll(ByteArray array)
public byte pop()
public byte peek()
public byte first()
public void clear()
public byte[] shrink()
items
public byte[] ensureCapacity(int additionalCapacity)
items
public byte[] setSize(int newSize)
items
protected byte[] resize(int newSize)
public void sort()
public void reverse()
public void shuffle()
public void truncate(int newSize)
public byte random()
public byte[] toArray()
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object object)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
public java.lang.String toString(java.lang.String separator)
public static ByteArray with(byte... array)
ByteArray(byte[])