|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--inria.util.ByteArray
The ByteArray class represents an array of bytes for fast access in networking packages. ByteArrays are constant; their values cannot be changed after they are created. ByteBuffers support mutable byte arrays.
ByteArray is a good substitute of String in networking packages.
Field Summary | |
protected byte[] |
buff
|
protected static byte |
caseDiff
|
protected int |
count
|
protected java.lang.String |
stringValue
|
Constructor Summary | |
protected |
ByteArray()
constructs an empty ByteArray object for subclasses. |
|
ByteArray(byte[] array,
int offset,
int length)
constructs a ByteArray object and initializes it from the given array. |
|
ByteArray(java.lang.String s)
constructs a ByteArray object and initializes it from the given string. |
Method Summary | |
java.lang.Object |
clone()
returns a cloned instance of the current object. |
int |
compare(ByteArray array)
compares with the given array. |
int |
compareIgnoreCase(ByteArray array)
compares with the given array. |
boolean |
containedIn(byte[] array,
int offset)
returns true if the given array contains the current array at the given offset. |
boolean |
containedIn(ByteArray array)
returns true if the given array contains the current array. |
boolean |
containedInIgnoreCase(byte[] array,
int offset)
returns true if the given array contains this array at the given offset. |
void |
copyTo(byte[] array,
int offset)
Copies the byte array to the given byte array. |
boolean |
endsWith(byte b)
Tests if this array ends with the specified byte. |
boolean |
endsWith(ByteArray suffix)
Tests if this array ends with the specified suffix. |
boolean |
equals(ByteArray array)
returns true if the given array equals the current array. |
boolean |
equalsIgnoreCase(ByteArray s)
returns true if the given array equals this array. |
int |
getLength()
returns the length of data. |
int |
indexOf(ByteArray str,
int from)
returns the index of the first occurrence of the given array within this array. |
int |
length()
returns the length of data. |
boolean |
startsWith(byte b)
Tests if this array starts with the specified byte. |
boolean |
startsWith(ByteArray prefix)
Tests if this array starts with the specified prefix. |
boolean |
startsWith(ByteArray prefix,
int offset)
Tests if this array starts with the specified prefix. |
java.lang.String |
toString()
returns the string representation of data. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final byte caseDiff
protected byte[] buff
protected int count
protected java.lang.String stringValue
Constructor Detail |
protected ByteArray()
public ByteArray(java.lang.String s)
s
- the string.public ByteArray(byte[] array, int offset, int length)
array
- the array of bytes.offset
- the offset in the array.length
- the length of bytes.Method Detail |
public int getLength()
public int length()
public boolean equals(ByteArray array)
array
- the array to compare.public int compare(ByteArray array)
array
- the array to compare.public boolean containedIn(ByteArray array)
array
- the array to compare.public boolean containedIn(byte[] array, int offset)
array
- the array to compare.offset
- the offset in the given array.public boolean equalsIgnoreCase(ByteArray s)
s
- the array to compare.public boolean containedInIgnoreCase(byte[] array, int offset)
array
- the array to compare.offset
- the offset in the given array.public int compareIgnoreCase(ByteArray array)
array
- the array to compare.public boolean startsWith(ByteArray prefix)
prefix
- the prefix.true
if the byte array represented by the
argument is a prefix of the sub-array of this object;
false
otherwise.public boolean startsWith(ByteArray prefix, int offset)
prefix
- the prefix.offset
- where to begin looking in the array.true
if the byte array represented by the
argument is a prefix of the sub-array of this object starting
at index offset
; false
otherwise.public boolean endsWith(ByteArray suffix)
suffix
- the suffix.true
if the byte array represented by the
argument is a suffix of this array represented by
this object; false
otherwise.public boolean startsWith(byte b)
b
- the byte value.public boolean endsWith(byte b)
b
- the byte value.public int indexOf(ByteArray str, int from)
str
- the array to search.public void copyTo(byte[] array, int offset)
array
- the destination byte array.offset
- the offset in the destination byte array.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.