public class ByteArray extends ByteArrayInterface implements Serializable
data, hashBuffer, length, offset| Constructor | Description |
|---|---|
ByteArray() |
Default constructor.
|
ByteArray(byte[] p_data) |
Create a byte array of specified length and provided array.
|
ByteArray(byte[] p_data,
int offset,
int length) |
Create a byte array of specified length and provided array.
|
ByteArray(int length) |
Create a byte array of specified length.
|
| Modifier and Type | Method | Description |
|---|---|---|
ByteArray |
append(byte b) |
Append the byte value into this
ByteArray |
ByteArray |
append(byte[] data) |
Append the content of the given byte [] into this instance.
|
ByteArray |
append(byte[] a,
int p_offset,
int p_length) |
Append the given byte array data to this instance.
|
ByteArray |
append(ByteArrayInterface p) |
Copy the content of the given parameter and append them at the end of this instance.
|
ByteArray |
append(char... str) |
append all the chars to this instance of
ByteArray |
ByteArray |
append(char ch) |
append all the chars to this instance of
ByteArray |
ByteArray |
append(int n) |
Append the integer value as printable characters into this
ByteArray |
ByteArray |
append(String str) |
Append the string value in this
ByteArray. |
ByteArray |
appendAsHexString(byte[] data,
int offset,
int length) |
Append the given byte array as hex char at the end of this
ByteArrayInterface. |
ByteArray |
appendIPAddress(byte[] a) |
|
ByteArray |
appendRandomHexChars(int length) |
Append some random hex char at the end of this
ByteArrayInterface |
ByteArray |
copy(byte[] other) |
Copy the content from other byte [] to this instance.
|
ByteArray |
copy(byte[] data,
int offset,
int length) |
Copy the content from other
ByteArray to this instance. |
ByteArray |
copy(ByteArray other) |
Copy the content from other
ByteArray to this instance. |
ByteArray |
copy(String data) |
Copy the string data to this instance.
|
int |
getLength() |
Get the current length of this
ByteArray |
int |
hashCode() |
Generate the hash code for this instance.
|
void |
reset() |
Reset the byte array to initial value.
|
String |
toString() |
equals, equalspublic ByteArray()
public ByteArray(int length)
length - a byte array will be allocated for this length.public ByteArray(byte[] p_data)
p_data - a byte array will be allowed with this length and content will be copied.public ByteArray(byte[] p_data,
int offset,
int length)
p_data - a byte array will be allowed with thisoffset - from where the data will be copiedlength - the length of the content will be copied.public void reset()
reset in interface Reusablereset in class ByteArrayInterfacepublic ByteArray copy(ByteArray other)
ByteArray to this instance. Old content of this instance will be overwritten.other - Content of this instance will be copied here.public ByteArray copy(byte[] other)
copy in class ByteArrayInterfaceother - Content of this instance will be copied here.public ByteArray copy(byte[] data, int offset, int length)
ByteArray to this instance.copy in class ByteArrayInterfacedata - Content of this instance will be copied here.offset - starting index of source byte array.length - length of the source byte array.public ByteArray copy(String data)
copy in class ByteArrayInterfacedata - Content of this instance will be copied here.public ByteArray append(byte[] data)
append in class ByteArrayInterfacedata - content of this byte [] will be copied.public ByteArray append(String str)
ByteArray. ASCII byte of each char will be added.append in class ByteArrayInterfacestr - The value to be appended.ByteArraypublic ByteArray append(char ch)
ByteArrayappend in class ByteArrayInterfacech - char to be appended into this instance.ByteArraypublic ByteArray append(char... str)
ByteArrayappend in class ByteArrayInterfacestr - multiple chars to be appended into this instance.ByteArraypublic ByteArray appendRandomHexChars(int length)
ByteArrayInterfaceappendRandomHexChars in class ByteArrayInterfacelength - Number of hex char to be added.ByteArrayInterfacepublic ByteArray appendAsHexString(byte[] data, int offset, int length)
ByteArrayInterface.
For example if the given byte [] contains word 'hello' into it,
the byte array data = {68, 65, 6c, 6c, 6f}
after calling this method it will append '68656c6f' at the end of this ByteArrayInterface
so after adding this instance will contain data = {36 38 36 35 36 63 36 63 36 66}appendAsHexString in class ByteArrayInterfacedata - byte array whose data will be appended as hex string.offset - starting index of byte [] to be appended into thislength - length of the given byte array to be appended as hex string.ByteArrayInterfacepublic int getLength()
ByteArraygetLength in class ByteArrayInterfaceByteArraypublic ByteArray append(byte b)
ByteArrayappend in class ByteArrayInterfaceb - byte value to be appendedpublic ByteArray append(int n)
ByteArrayappend in class ByteArrayInterfacen - Integer value to be appendedpublic ByteArray append(byte[] a, int p_offset, int p_length)
append in class ByteArrayInterfacea - byte array to be appended.p_offset - starting index of the byte array to be appended.p_length - length of the byte array to be appended.ByteArraypublic ByteArray append(ByteArrayInterface p)
append in class ByteArrayInterfacep - content of this parameter will be appended here.ByteArraypublic int hashCode()
public ByteArray appendIPAddress(byte[] a)
public String toString()
toString in class ByteArrayInterfaceCopyright © 2025. All rights reserved.