@InterfaceAudience.Public @InterfaceStability.Stable public class DataByteArray extends java.lang.Object implements java.lang.Comparable, java.io.Serializable
Constructor and Description |
---|
DataByteArray()
Default constructor.
|
DataByteArray(byte[] b)
Construct a byte array using the provided bytes as the content.
|
DataByteArray(byte[] b,
int start,
int end)
Construct a byte array using a portion of the provided bytes as content.
|
DataByteArray(DataByteArray b,
DataByteArray c)
Construct a byte array concatenating the two provided
byte arrays as the content.
|
DataByteArray(java.lang.String s)
Construct a byte array from a String.
|
Modifier and Type | Method and Description |
---|---|
DataByteArray |
append(byte[] ba) |
DataByteArray |
append(byte[] ba,
int start,
int baLength) |
DataByteArray |
append(DataByteArray b)
Append given byte array to the internal byte array.
|
DataByteArray |
append(java.lang.String str) |
static int |
compare(byte[] b1,
byte[] b2) |
int |
compareTo(java.lang.Object other)
Compare two byte arrays.
|
boolean |
equals(java.lang.Object other) |
byte[] |
get()
Get the underlying byte array.
|
int |
hashCode() |
static int |
hashCode(byte[] buf) |
void |
set(byte[] b)
Set the internal byte array.
|
void |
set(java.lang.String s)
Set the internal byte array.
|
int |
size()
Find the size of the byte array.
|
java.lang.String |
toString()
Convert the byte array to a string.
|
public DataByteArray()
public DataByteArray(byte[] b)
b
- byte array to use as content. A reference to the bytes
will be taken, the underlying bytes will not be copied.public DataByteArray(DataByteArray b, DataByteArray c)
b
- the first byte array to use as content.c
- the other byte array to use as content.public DataByteArray(byte[] b, int start, int end)
b
- byte array to read from. A copy of the underlying bytes will be
made.start
- starting point to copy fromend
- ending point to copy to, exclusive.public DataByteArray(java.lang.String s)
s
- String to make a byte array out of.public int size()
public byte[] get()
public void set(byte[] b)
b
- byte array to store. The contents of the byte array are
not copied.public void set(java.lang.String s)
s
- String to copy. The contents of the string are copied.public DataByteArray append(DataByteArray b)
b
- byte array who's contents to append. The contents of the byte array are
copied.public DataByteArray append(byte[] ba)
public DataByteArray append(byte[] ba, int start, int baLength)
public DataByteArray append(java.lang.String str)
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object other)
DataType.compare(java.lang.Object, java.lang.Object)
will be called.compareTo
in interface java.lang.Comparable
other
- Other object to compare to.public static int compare(byte[] b1, byte[] b2)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static int hashCode(byte[] buf)
Copyright © 2007-2017 The Apache Software Foundation