|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.iapi.util.ByteArray
public final class ByteArray
ByteArray wraps java byte arrays (byte[]) to allow byte arrays to be used as keys in hashtables. This is required because the equals function on byte[] directly uses reference equality.
This class also allows the trio of array, offset and length to be carried around as a single object.
Field Summary | |
---|---|
private byte[] |
array
|
private int |
length
|
private int |
offset
|
Constructor Summary | |
---|---|
ByteArray()
|
|
ByteArray(byte[] array)
|
|
ByteArray(byte[] array,
int offset,
int length)
Create an instance of this class that wraps ths given array. |
Method Summary | |
---|---|
private static boolean |
equals(byte[] a,
int aOffset,
int aLength,
byte[] b,
int bOffset,
int bLength)
Compare two byte arrays using value equality. |
boolean |
equals(java.lang.Object other)
Value equality for byte arrays. |
byte[] |
getArray()
|
int |
getLength()
|
int |
getOffset()
|
int |
hashCode()
|
void |
readExternal(java.io.ObjectInput in)
Read this object from a stream of stored objects. |
void |
setBytes(byte[] array)
|
void |
setBytes(byte[] array,
int length)
|
void |
setBytes(byte[] array,
int offset,
int length)
|
void |
setLength(int newLength)
|
void |
writeExternal(java.io.ObjectOutput out)
Write the byte array out w/o compression |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private byte[] array
private int offset
private int length
Constructor Detail |
---|
public ByteArray(byte[] array, int offset, int length)
public ByteArray(byte[] array)
public ByteArray()
Method Detail |
---|
public void setBytes(byte[] array)
public void setBytes(byte[] array, int length)
public void setBytes(byte[] array, int offset, int length)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final byte[] getArray()
public final int getOffset()
public final int getLength()
public final void setLength(int newLength)
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
in
- read this.
java.io.IOException
- thrown on errorpublic void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
out
- write bytes here.
java.io.IOException
- thrown on errorprivate static boolean equals(byte[] a, int aOffset, int aLength, byte[] b, int bOffset, int bLength)
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |