Package com.reve.utils.bytearray
Class ByteArrayBuffer
java.lang.Object
com.reve.utils.bytearray.ByteArrayInterface
com.reve.utils.bytearray.ByteArrayBuffer
- All Implemented Interfaces:
Reusable
-
Field Summary
Fields inherited from class com.reve.utils.bytearray.ByteArrayInterface
data, hashBuffer, length, offset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(byte b) Append the byte value into thisByteArrayBufferappend(byte[] a) append(byte[] a, int p_offset, int p_length) append(char ch) append all the chars to this instance ofByteArrayappend(char... str) append all the chars to this instance ofByteArrayBufferappend(int n) Append the integer value as printable characters into thisByteArrayBufferAppend the string value in thisByteArrayBuffer.appendAsHexString(byte[] data, int offset, int length) Append the given byte array as hex char at the end of thisByteArrayInterface.appendRandomHexChars(int length) Append some random hex char at the end of thisByteArrayInterfacecopy(byte[] b) copy(byte[] p_arr, int p_offset, int p_length) booleanintinthashCode()voidreset()Reset all the parameter of the instance to the initial value, so that it can be reused without any problem.toString()Methods inherited from class com.reve.utils.bytearray.ByteArrayInterface
equals
-
Constructor Details
-
ByteArrayBuffer
public ByteArrayBuffer(byte[] p_arr)
-
-
Method Details
-
copy
-
copy
- Specified by:
copyin classByteArrayInterface
-
copy
- Specified by:
copyin classByteArrayInterface
-
copy
- Specified by:
copyin classByteArrayInterface
-
reset
public void reset()Description copied from interface:ReusableReset all the parameter of the instance to the initial value, so that it can be reused without any problem.- Specified by:
resetin interfaceReusable- Specified by:
resetin classByteArrayInterface
-
hashCode
public int hashCode() -
equals
- Overrides:
equalsin classByteArrayInterface
-
toString
- Specified by:
toStringin classByteArrayInterface
-
append
- Specified by:
appendin classByteArrayInterface
-
append
- Specified by:
appendin classByteArrayInterface
-
append
- Specified by:
appendin classByteArrayInterface
-
append
Append the integer value as printable characters into thisByteArrayBuffer- Specified by:
appendin classByteArrayInterface- Parameters:
n- Integer value to be appended
-
append
Append the byte value into thisByteArrayBuffer- Specified by:
appendin classByteArrayInterface- Parameters:
b- byte value to be appended
-
append
Append the string value in thisByteArrayBuffer. ASCII byte of each char will be added.- Specified by:
appendin classByteArrayInterface- Parameters:
str- The value to be appended.- Returns:
- the instance of this
ByteArrayBuffer
-
append
append all the chars to this instance ofByteArray- Specified by:
appendin classByteArrayInterface- Parameters:
ch- char to be appended into this instance.- Returns:
- the instance of this
ByteArray
-
append
append all the chars to this instance ofByteArrayBuffer- Specified by:
appendin classByteArrayInterface- Parameters:
str- multiple chars to be appended into this instance.- Returns:
- the instance of this
ByteArrayBuffer
-
appendRandomHexChars
Append some random hex char at the end of thisByteArrayInterface- Specified by:
appendRandomHexCharsin classByteArrayInterface- Parameters:
length- Number of hex char to be added.- Returns:
- the instance of this
ByteArrayInterface
-
appendAsHexString
Append the given byte array as hex char at the end of thisByteArrayInterface. 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 thisByteArrayInterfaceso after adding this instance will contain data = {36 38 36 35 36 63 36 63 36 66}- Specified by:
appendAsHexStringin classByteArrayInterface- Parameters:
data- 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.- Returns:
- the instance of this
ByteArrayInterface
-
getLength
public int getLength()- Specified by:
getLengthin classByteArrayInterface
-