public class Data extends java.lang.Object implements ByteArray, java.lang.Cloneable
ByteArray.Helper| Constructor and Description |
|---|
Data(byte[] bytes)
Create data view with bytes
|
Data(byte[] buffer,
int offset,
int size)
Create data view with range [start, end)
|
Data(ByteArray data)
Clone data view
|
| Modifier and Type | Method and Description |
|---|---|
Data |
clone() |
ByteArray |
concat(byte[]... others) |
ByteArray |
concat(ByteArray... others)
Combines two or more data.
|
boolean |
equals(byte[] other) |
boolean |
equals(byte[] otherBuffer,
int otherOffset,
int otherCount) |
boolean |
equals(ByteArray other) |
boolean |
equals(java.lang.Object other) |
int |
find(byte value) |
int |
find(byte[] bytes) |
int |
find(byte[] bytes,
int start) |
int |
find(byte[] bytes,
int start,
int end)
Search sub bytes in range [start, end)
|
int |
find(ByteArray sub) |
int |
find(ByteArray sub,
int start) |
int |
find(ByteArray sub,
int start,
int end) |
int |
find(byte value,
int start) |
int |
find(byte value,
int start,
int end)
Search value in range [start, end)
|
int |
find(int value) |
int |
find(int value,
int start) |
int |
find(int value,
int start,
int end) |
byte[] |
getBuffer() |
byte |
getByte(int index)
Get item value with position
|
byte[] |
getBytes()
Get bytes from inner buffer with range [offset, offset + length)
|
byte[] |
getBytes(int start) |
byte[] |
getBytes(int start,
int end) |
int |
getOffset() |
int |
getSize() |
int |
hashCode() |
MutableData |
mutableCopy() |
static ByteArray |
random(int length) |
ByteArray |
slice(int start) |
ByteArray |
slice(int start,
int end)
Get sub data within range [start, end)
|
java.lang.String |
toHexString() |
java.lang.String |
toString() |
public static final Data ZERO
public Data(byte[] buffer,
int offset,
int size)
buffer - - data bufferoffset - - data view offsetsize - - data view sizepublic Data(byte[] bytes)
bytes - - data viewpublic Data(ByteArray data)
data - - other data viewpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic boolean equals(byte[] otherBuffer,
int otherOffset,
int otherCount)
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toHexString()
toHexString in interface ByteArraypublic int find(byte value,
int start,
int end)
ByteArraypublic int find(byte[] bytes,
int start,
int end)
ByteArraypublic byte getByte(int index)
ByteArraypublic byte[] getBytes()
ByteArraypublic ByteArray slice(int start, int end)
public Data clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic MutableData mutableCopy()
public static ByteArray random(int length)