|
||||||||||
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 | |
---|---|
void |
append(DataByteArray b)
Append given byte array to the internal byte array. |
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()
|
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 void append(DataByteArray b)
b
- byte array who's contents to append. The contents of the byte array are
copied.public String toString()
toString
in class Object
public int compareTo(Object other)
DataType.compare(java.lang.Object, java.lang.Object)
will be called.
compareTo
in interface Comparable
other
- Other object to compare to.
public static int compare(byte[] b1, byte[] b2)
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |