|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.data.DataByteArray
@InterfaceAudience.Public @InterfaceStability.Stable public class DataByteArray
An implementation of byte array. This is done as an object because we need to be able to implement compareTo, toString, hashCode, and some other methods.
| Constructor Summary | |
|---|---|
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(String s)
Construct a byte array from a String. |
|
| Method Summary | |
|---|---|
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(String str)
|
static int |
compare(byte[] b1,
byte[] b2)
|
int |
compareTo(Object other)
Compare two byte arrays. |
boolean |
equals(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(String s)
Set the internal byte array. |
int |
size()
Find the size of the byte array. |
String |
toString()
Convert the byte array to a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
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(String s)
s - String to make a byte array out of.| Method Detail |
|---|
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(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(String str)
public String toString()
toString in class Objectpublic int compareTo(Object other)
DataType.compare(java.lang.Object, java.lang.Object) will be called.
compareTo in interface Comparableother - Other object to compare to.
public static int compare(byte[] b1,
byte[] b2)
public boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic static int hashCode(byte[] buf)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||