Back to index

wims  3.65+svn20090927
Public Member Functions | Protected Attributes
fr.ove.utils.ByteVector Class Reference

List of all members.

Public Member Functions

 ByteVector (int initialCapacity, int capacityIncrement)
 ByteVector (int initialCapacity)
 ByteVector ()
final synchronized void trimToSize ()
final int size ()
final boolean isEmpty ()
final boolean contains (byte elem)
final int indexOf (byte elem)
final synchronized int indexOf (byte elem, int index)
final synchronized byte elementAt (int index)
final synchronized void addElement (byte b)
final synchronized void addElements (byte[] b)
final synchronized void addElements (byte[] b, int length)
final synchronized boolean removeElement (byte b)
final synchronized void removeElementAt (int index)
final synchronized void removeAllElements ()
final synchronized byte[] getBytes ()
final synchronized void ensureCapacity (int minCapacity)
final synchronized String toString ()

Protected Attributes

byte elementData []
int elementCount
int capacityIncrement

Detailed Description

Definition at line 8 of file ByteVector.java.


Constructor & Destructor Documentation

fr.ove.utils.ByteVector.ByteVector ( int  initialCapacity,
int  capacityIncrement 
) [inline]

Definition at line 13 of file ByteVector.java.

                                                                  {
       super();
       this.elementData = new byte[initialCapacity];
       this.capacityIncrement = capacityIncrement;
    }
fr.ove.utils.ByteVector.ByteVector ( int  initialCapacity) [inline]

Definition at line 19 of file ByteVector.java.

                                           {
       this(initialCapacity, 5);
    }

Definition at line 23 of file ByteVector.java.

                        {
       this(10);
    }

Member Function Documentation

final synchronized void fr.ove.utils.ByteVector.addElement ( byte  b) [inline]

Definition at line 71 of file ByteVector.java.

Here is the call graph for this function:

Here is the caller graph for this function:

final synchronized void fr.ove.utils.ByteVector.addElements ( byte[]  b) [inline]

Definition at line 76 of file ByteVector.java.

                                                         {
        if (b != null) {
           ensureCapacity(elementCount + b.length);
            System.arraycopy(b, 0, elementData, elementCount, b.length);
            elementCount += b.length;
        }
        else
           throw new NullPointerException("Try to add null elements");
    }

Here is the call graph for this function:

final synchronized void fr.ove.utils.ByteVector.addElements ( byte[]  b,
int  length 
) [inline]

Definition at line 86 of file ByteVector.java.

                                                                     {
        if (b != null) {
            if ((length > 0) && (length <= b.length)) {
                  ensureCapacity(elementCount + b.length);
                System.arraycopy(b, 0, elementData, elementCount, length);
                elementCount += length;
            }
            else
                  throw new IllegalArgumentException("Invalid length argument : " + length);
        }
        else
           throw new NullPointerException("Try to add null elements");
    }

Here is the call graph for this function:

final boolean fr.ove.utils.ByteVector.contains ( byte  elem) [inline]

Definition at line 44 of file ByteVector.java.

                                             {
       return indexOf(elem, 0) >= 0;
    }

Here is the call graph for this function:

final synchronized byte fr.ove.utils.ByteVector.elementAt ( int  index) [inline]

Definition at line 60 of file ByteVector.java.

                                                        {
       if (index >= elementCount)
           throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);

       try {
           return elementData[index];
       } catch (ArrayIndexOutOfBoundsException e) {
           throw new ArrayIndexOutOfBoundsException(index + " < 0");
       }
    }
final synchronized void fr.ove.utils.ByteVector.ensureCapacity ( int  minCapacity) [inline]

Definition at line 133 of file ByteVector.java.

                                                                   {
       int oldCapacity = elementData.length;
       if (minCapacity > oldCapacity) {
           byte oldData[] = elementData;
           int newCapacity = (capacityIncrement > 0) ? (oldCapacity + capacityIncrement) : (oldCapacity * 2);
              if (newCapacity < minCapacity)
                     newCapacity = minCapacity;
           elementData = new byte[newCapacity];
           System.arraycopy(oldData, 0, elementData, 0, elementCount);
       }
    }

Here is the caller graph for this function:

final synchronized byte [] fr.ove.utils.ByteVector.getBytes ( ) [inline]

Definition at line 128 of file ByteVector.java.

                                                {
        trimToSize();
           return elementData;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

final int fr.ove.utils.ByteVector.indexOf ( byte  elem) [inline]

Definition at line 48 of file ByteVector.java.

                                        {
       return indexOf(elem, 0);
    }

Here is the caller graph for this function:

final synchronized int fr.ove.utils.ByteVector.indexOf ( byte  elem,
int  index 
) [inline]

Definition at line 52 of file ByteVector.java.

                                                                {
       for (int i = index; i < elementCount; i++) {
           if (elem == elementData[i])
                     return i;
       }
       return -1;
    }

Definition at line 40 of file ByteVector.java.

                                   {
       return elementCount == 0;
    }
final synchronized void fr.ove.utils.ByteVector.removeAllElements ( ) [inline]

Definition at line 123 of file ByteVector.java.

final synchronized boolean fr.ove.utils.ByteVector.removeElement ( byte  b) [inline]

Definition at line 100 of file ByteVector.java.

                                                            {
       int i = indexOf(b);
       if (i >= 0) {
           removeElementAt(i);
           return true;
       }
       return false;
    }

Here is the call graph for this function:

final synchronized void fr.ove.utils.ByteVector.removeElementAt ( int  index) [inline]

Definition at line 109 of file ByteVector.java.

                                                              {
       if (index >= elementCount) {
           throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
       }
       else if (index < 0) {
           throw new ArrayIndexOutOfBoundsException(index);
       }
       int j = elementCount - index - 1;
       if (j > 0) {
           System.arraycopy(elementData, index + 1, elementData, index, j);
       }
       elementCount--;
    }

Here is the caller graph for this function:

final int fr.ove.utils.ByteVector.size ( ) [inline]

Definition at line 36 of file ByteVector.java.

                            {
       return elementCount;
    }
final synchronized String fr.ove.utils.ByteVector.toString ( ) [inline]

Definition at line 145 of file ByteVector.java.

                                                {
        String s = " [ ";
       for (int i = 0 ; i <elementCount ; i++)
           s += elementData[i] + " ";
       s += "]";
       return s;
    }
final synchronized void fr.ove.utils.ByteVector.trimToSize ( ) [inline]

Definition at line 27 of file ByteVector.java.

                                                {
       int oldCapacity = elementData.length;
       if (elementCount < oldCapacity) {
           byte oldData[] = elementData;
           elementData = new byte[elementCount];
           System.arraycopy(oldData, 0, elementData, 0, elementCount);
       }
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 11 of file ByteVector.java.

Definition at line 10 of file ByteVector.java.

Definition at line 9 of file ByteVector.java.


The documentation for this class was generated from the following file: