Package net.i2p.data
Class ByteArray
java.lang.Object
net.i2p.data.ByteArray
- All Implemented Interfaces:
Serializable,Comparable<ByteArray>
public class ByteArray extends Object implements Serializable, Comparable<ByteArray>
Wrap up an array of bytes so that they can be compared and placed in hashes,
maps, and the like.
- See Also:
- Serialized Form
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description intcompareTo(ByteArray ba)booleanequals(Object o)byte[]getData()intgetOffset()intgetValid()Count how many of the bytes in the array are 'valid'.inthashCode()voidsetData(byte[] data)Warning, does not set validvoidsetOffset(int offset)voidsetValid(int valid)StringtoBase64()StringtoString()
-
Constructor Details
-
ByteArray
public ByteArray() -
ByteArray
public ByteArray(byte[] data)Sets valid = data.length, unless data is null Sets offset = 0- Parameters:
data- may be null
-
ByteArray
public ByteArray(byte[] data, int offset, int length)Sets offset = offset Sets valid = length- Parameters:
data- may be null but why would you do that
-
-
Method Details
-
getData
public byte[] getData() -
setData
public void setData(byte[] data)Warning, does not set valid -
getValid
public int getValid()Count how many of the bytes in the array are 'valid'. this property does not necessarily have meaning for all byte arrays. -
setValid
public void setValid(int valid) -
getOffset
public int getOffset() -
setOffset
public void setOffset(int offset) -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<ByteArray>
-
hashCode
public final int hashCode() -
toString
-
toBase64
-