| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.adapters.ByteArray
java.lang.Object
|
+----com.objectspace.jgl.adapters.ArrayAdapter
|
+----com.objectspace.jgl.adapters.ByteArray
- public class ByteArray
- extends ArrayAdapter
ByteArray allows a native array of bytes to be accessed like a JGL
Container. It is particularly useful for applying generic algorithms
such as Sorting.sort() to a native array.
-
ByteArray()
- Construct myself to refer to an empty array.
-
ByteArray(byte[])
- Construct myself to refer to a native Java array.
-
ByteArray(ByteArray)
- Construct myself to refer to an existing ByteArray.
-
ByteArray(ByteBuffer)
- Construct myself to be a copy of an existing ByteBuffer.
-
at(int)
- Return the integer at the specified index as a Byte object.
-
begin()
- Return an iterator positioned at my first item.
-
byteAt(int)
- Return the integer at the specified index as a Byte object.
-
clone()
- Return a shallow copy of myself.
-
elements()
- Return an Enumeration of my components.
-
end()
- Return an iterator positioned immediately after my last item.
-
equals(byte[])
- Return true if I contain the same items in the same order as
a native array of bytes.
-
equals(ByteArray)
- Return true if I contain the same items in the same order as
another ByteArray.
-
equals(ByteBuffer)
- Return true if I contain the same items in the same order as
another ByteBuffer.
-
equals(Object)
- Return true if I'm equal to a specified object.
-
finish()
- Return an iterator positioned immediately after my last item.
-
get()
- Retrieve the underlying primitive array.
-
maxSize()
- Return the maximum number of objects that I can contain.
-
put(int, byte)
- Set the value of a specified index.
-
put(int, Object)
- Set the object at a specified index.
-
size()
- Return the number of objects that I contain.
-
start()
- Return an iterator positioned at my first item.
-
toString()
- Return a string that describes me.
ByteArray
public ByteArray()
- Construct myself to refer to an empty array.
ByteArray
public ByteArray(ByteArray array)
- Construct myself to refer to an existing ByteArray.
- Parameters:
- array - The ByteArray to copy.
ByteArray
public ByteArray(ByteBuffer buffer)
- Construct myself to be a copy of an existing ByteBuffer.
- Parameters:
- array - The ByteBuffer to copy.
ByteArray
public ByteArray(byte array[])
- Construct myself to refer to a native Java array.
- Parameters:
- array - The byte[] to ape.
clone
public synchronized Object clone()
- Return a shallow copy of myself.
- Overrides:
- clone in class ArrayAdapter
toString
public synchronized String toString()
- Return a string that describes me.
- Overrides:
- toString in class Object
equals
public boolean equals(Object object)
- Return true if I'm equal to a specified object.
- Parameters:
- object - The object to compare myself against.
- Returns:
- true if I'm equal to the specified object.
- Overrides:
- equals in class ArrayAdapter
equals
public boolean equals(ByteArray object)
- Return true if I contain the same items in the same order as
another ByteArray.
- Parameters:
- array - The ByteArray to compare myself against.
- Returns:
- true if I'm equal to the specified object.
equals
public boolean equals(ByteBuffer buffer)
- Return true if I contain the same items in the same order as
another ByteBuffer.
- Parameters:
- buffer - The ByteBuffer to compare myself against.
equals
public synchronized boolean equals(byte array[])
- Return true if I contain the same items in the same order as
a native array of bytes.
- Parameters:
- array - The array to compare myself against.
get
public byte[] get()
- Retrieve the underlying primitive array.
size
public int size()
- Return the number of objects that I contain.
maxSize
public int maxSize()
- Return the maximum number of objects that I can contain.
- Overrides:
- maxSize in class ArrayAdapter
elements
public Enumeration elements()
- Return an Enumeration of my components.
start
public ForwardIterator start()
- Return an iterator positioned at my first item.
begin
public synchronized ByteIterator begin()
- Return an iterator positioned at my first item.
finish
public ForwardIterator finish()
- Return an iterator positioned immediately after my last item.
end
public synchronized ByteIterator end()
- Return an iterator positioned immediately after my last item.
at
public Object at(int index)
- Return the integer at the specified index as a Byte object.
- Parameters:
- index - The index.
byteAt
public synchronized byte byteAt(int index)
- Return the integer at the specified index as a Byte object.
- Parameters:
- index - The index.
put
public void put(int index,
Object object)
- Set the object at a specified index. The object must be a Number
- Parameters:
- index - The index.
- object - The object to place at the specified index.
- Throws: ClassCastException
- if object is not a Number
- Throws: IndexOutOfBoundsException
- if index is invalid.
put
public synchronized void put(int index,
byte object)
- Set the value of a specified index.
- Parameters:
- index - The index.
- object - The byte to place at the specified index.
- Throws: IndexOutOfBoundsException
- if index is invalid.
All Packages Class Hierarchy This Package Previous Next Index