Class ByteVector
java.lang.Object
|
+----java.util.Vector
|
+----ByteVector
- public class ByteVector
- extends Vector
NetRand Project
Software Engineering - CS536
University of Wisconsin - Milwaukee
Authors:
- Spring 1998 - Francis William Kasper
File: ByteVector.java
The ByteVector class adds functionality to the Vector class for operating
specifically on Vectors of Byte objects.
-
ByteVector()
- calls the Vector() constructor
-
ByteVector(int)
- calls the Vector( int initialCapacity ) constructor, which allows the
initial capacity of the vector to be specified
-
ByteVector(int, int)
- calls the Vector( ini initialCapacity, int capacityIncrement ) constructor,
which allows the initial capacity of the vector to be specified as well as
the amount by which the capacity of increased when the ByteVector
overflows.
-
addByte(byte)
- adds a byte to the ByteVector
-
addBytes(byte[])
- add an array of bytes to the ByteVector
-
addBytes(byte[], int, int)
- add a section of an array of bytes to the ByteVector
-
byteAt(int)
- returns the value of the byte at a specific location in the ByteVector
-
copyInto(byte[])
- copies the contents of the ByteVector into an array
-
copyInto(byte[], int, int)
- copies the contents of the ByteVector into an array
-
copyInto(byte[], int, int, int)
- copies the contents of the ByteVector into an array
-
firstByte()
-
-
lastByte()
-
-
truncFromFront(int)
- sets the size of the ByteVector and deletes excess bytes from the
front of the ByteVector
ByteVector
public ByteVector()
- calls the Vector() constructor
ByteVector
public ByteVector(int initialCapacity)
- calls the Vector( int initialCapacity ) constructor, which allows the
initial capacity of the vector to be specified
- Parameters:
- initialCapacity - - the initial number of bytes the ByteVector can
hold
ByteVector
public ByteVector(int initialCapacity,
int capacityIncrement)
- calls the Vector( ini initialCapacity, int capacityIncrement ) constructor,
which allows the initial capacity of the vector to be specified as well as
the amount by which the capacity of increased when the ByteVector
overflows.
- Parameters:
- initialCapacity - - the initial number of byte the ByteVector can
hold
- capacityIncrement - - the amount to increment Vector when overflow
addByte
public final synchronized void addByte(byte theByte)
- adds a byte to the ByteVector
- Parameters:
- theByte - - the byte to add to the ByteVector
addBytes
public final synchronized void addBytes(byte anArray[])
- add an array of bytes to the ByteVector
- Parameters:
- anArray - - the array of bytes to add the ByteVector
addBytes
public final synchronized void addBytes(byte anArray[],
int beginIndex,
int endIndex)
- add a section of an array of bytes to the ByteVector
- Parameters:
- anArray - - an array containing the bytes to add to the ByteVector
- beginIndex - - index of the first byte to add to the ByteVector
- endIndex - - adds all bytes up to but not including anArray[endIndex]
copyInto
public final synchronized void copyInto(byte anArray[])
- copies the contents of the ByteVector into an array
- Parameters:
- anArray - - bytes are copied into this array starting at the
first byte in the ByteVector until anArray[] is full
copyInto
public final synchronized void copyInto(byte anArray[],
int beginIndex,
int endIndex)
- copies the contents of the ByteVector into an array
- Parameters:
- anArray - - the array to copy the bytes into
- beginIndex - - the index of the first element in the ByteVector
to begin copying into anArray[]
- endIndex - - the index of the element in the ByteVector immediately
after the last byte to be copied into anArray[]
copyInto
public final synchronized void copyInto(byte anArray[],
int offset,
int beginIndex,
int endIndex)
- copies the contents of the ByteVector into an array
- Parameters:
- anArray - - the array to copy the bytes into
- offset - - offset into anArray[]
- beginIndex - - the index of the first element in the ByteVector
to begin copying into anArray[]
- endIndex - - the index of the element in the ByteVector immediately
after the last byte to be copied into anArray[]
byteAt
public final synchronized byte byteAt(int index)
- returns the value of the byte at a specific location in the ByteVector
- Parameters:
- index - - index of the byte in the ByteVector
- Returns:
- the value of the byte residing at that index
firstByte
public final synchronized byte firstByte()
- Returns:
- the value of the first byte in the ByteVector
lastByte
public final synchronized byte lastByte()
- Returns:
- the value of the last byte in the ByteVector
truncFromFront
public final synchronized void truncFromFront(int vectorSize)
- sets the size of the ByteVector and deletes excess bytes from the
front of the ByteVector
- Parameters:
- vectorSize - - the desired size of the ByteVector