public class BytesArray extends Object implements BytesModifiable
Modifier and Type | Field and Description |
---|---|
byte[] |
a |
static CharsetEncoder |
encoder |
int |
n |
Constructor and Description |
---|
BytesArray() |
BytesArray(byte[] a)
For efficiency, does not clone the array arg.
|
BytesArray(byte[] a,
int n)
For efficiency, does not clone the array arg.
|
BytesArray(Bytes xs)
Clones the sequence arg.
|
BytesArray(int n) |
BytesArray(String s) |
Modifier and Type | Method and Description |
---|---|
void |
append(byte v) |
void |
append(byte[] vs) |
void |
append(byte[] vs,
int from,
int to) |
void |
append(ByteBuffer vs) |
void |
append(ByteBuffer vs,
int c) |
void |
append(Bytes vs) |
void |
append(Bytes vs,
int from,
int to) |
void |
append(String s) |
void |
append(String s,
int from,
int to) |
void |
clear() |
void |
compact() |
byte[] |
copyOf() |
byte[] |
copyOf(int i,
int c) |
void |
copyTo(ByteBuffer dest) |
void |
copyTo(int i,
byte[] dest,
int iDest,
int c) |
void |
copyTo(int i,
ByteBuffer dest,
int c) |
void |
ensureCapacity(int minCapacity) |
byte |
first() |
void |
insert(int i,
byte v) |
void |
insert(int i,
byte[] vs) |
void |
insert(int i,
byte[] vs,
int from,
int to) |
void |
insert(int i,
ByteBuffer vs) |
void |
insert(int i,
ByteBuffer vs,
int c) |
void |
insert(int i,
Bytes vs) |
void |
insert(int i,
Bytes vs,
int from,
int to) |
void |
insert(int i,
String s) |
void |
insert(int i,
String s,
int from,
int to) |
boolean |
isEmpty() |
byte |
last() |
int |
n()
Length of the sequence
|
static byte[] |
newArray(int oldCapacity,
int minNewCapacity)
Creates a new array whose capacity is at least minNewCapacity, and at least
1.618 * oldCapacity, up to Integer.MAX_VALUE.
|
void |
prepend(byte v) |
void |
prepend(byte[] vs) |
void |
prepend(byte[] vs,
int from,
int to) |
void |
prepend(ByteBuffer vs) |
void |
prepend(ByteBuffer vs,
int c) |
void |
prepend(Bytes vs) |
void |
prepend(Bytes vs,
int from,
int to) |
void |
prepend(String s) |
void |
prepend(String s,
int from,
int to) |
void |
prepForAppend(int c)
Makes room in this array for new values to be appended.
|
void |
prepForInsert(int i,
int c)
Makes room in this array for new values to be inserted.
|
void |
prepForPrepend(int c)
Makes room in this array for new values to be prepended.
|
void |
remove(byte v)
Removes a single copy of the specified value.
|
void |
removeIndex(int index)
Remove value at index.
|
void |
removeRange(int from,
int to)
Removes values starting at index from (inclusive) to index to (exclusive).
|
void |
set(int i,
byte v) |
void |
set(int i,
byte[] vs) |
void |
set(int i,
byte[] vs,
int from,
int to) |
String |
string() |
String |
string(int i,
int c)
Strings are encoded and decoded using the UTF-8 charset (multi-byte
charsets just aren't worth the increased complication in indexing).
|
byte |
v(int i)
Value at index i
|
public static final CharsetEncoder encoder
public byte[] a
public int n
public BytesArray(byte[] a)
public BytesArray(int n)
public BytesArray()
public BytesArray(byte[] a, int n)
public BytesArray(Bytes xs)
public BytesArray(String s)
public byte v(int i)
Bytes
public int n()
Bytes
public void copyTo(int i, byte[] dest, int iDest, int c)
public void copyTo(int i, ByteBuffer dest, int c)
public void copyTo(ByteBuffer dest)
public String string(int i, int c)
Bytes
public void set(int i, byte v)
set
in interface BytesModifiable
public void set(int i, byte[] vs)
set
in interface BytesModifiable
public void set(int i, byte[] vs, int from, int to)
set
in interface BytesModifiable
public void insert(int i, byte v)
insert
in interface BytesModifiable
public void insert(int i, Bytes vs)
insert
in interface BytesModifiable
public void insert(int i, Bytes vs, int from, int to)
insert
in interface BytesModifiable
public void insert(int i, String s)
insert
in interface BytesModifiable
public void insert(int i, String s, int from, int to)
insert
in interface BytesModifiable
public void insert(int i, byte[] vs)
insert
in interface BytesModifiable
public void insert(int i, byte[] vs, int from, int to)
insert
in interface BytesModifiable
public void insert(int i, ByteBuffer vs)
insert
in interface BytesModifiable
public void insert(int i, ByteBuffer vs, int c)
insert
in interface BytesModifiable
public void prepForInsert(int i, int c)
this.a
on [i,i+c)
are undefined. Writing meaningful values to these indices is up to the
caller.i
- The index at which new values will be insertedc
- The count of new values that will be insertedpublic void prepend(byte v)
prepend
in interface BytesModifiable
public void prepend(Bytes vs)
prepend
in interface BytesModifiable
public void prepend(Bytes vs, int from, int to)
prepend
in interface BytesModifiable
public void prepend(String s)
prepend
in interface BytesModifiable
public void prepend(String s, int from, int to)
prepend
in interface BytesModifiable
public void prepend(byte[] vs)
prepend
in interface BytesModifiable
public void prepend(byte[] vs, int from, int to)
prepend
in interface BytesModifiable
public void prepend(ByteBuffer vs)
prepend
in interface BytesModifiable
public void prepend(ByteBuffer vs, int c)
prepend
in interface BytesModifiable
public void prepForPrepend(int c)
this.a
on [0,c)
are undefined. Writing meaningful values to these indices is up to the
caller.c
- The count of new values that will be insertedpublic void append(byte v)
append
in interface BytesModifiable
public void append(Bytes vs)
append
in interface BytesModifiable
public void append(Bytes vs, int from, int to)
append
in interface BytesModifiable
public void append(String s)
append
in interface BytesModifiable
public void append(String s, int from, int to)
append
in interface BytesModifiable
public void append(byte[] vs)
append
in interface BytesModifiable
public void append(byte[] vs, int from, int to)
append
in interface BytesModifiable
public void append(ByteBuffer vs)
append
in interface BytesModifiable
public void append(ByteBuffer vs, int c)
append
in interface BytesModifiable
public void prepForAppend(int c)
this.a
on [this.n-c,this.n)
are undefined. Writing meaningful values to these indices is up to the
caller.c
- The count of new values that will be appendedpublic void remove(byte v)
BytesModifiable
remove
in interface BytesModifiable
public void removeRange(int from, int to)
BytesModifiable
removeRange
in interface BytesModifiable
public void removeIndex(int index)
BytesModifiable
removeIndex
in interface BytesModifiable
public void clear()
clear
in interface BytesModifiable
public void ensureCapacity(int minCapacity)
ensureCapacity
in interface BytesModifiable
public void compact()
compact
in interface BytesModifiable
public static byte[] newArray(int oldCapacity, int minNewCapacity)
Copyright © 2016 Metron, Inc.. All rights reserved.