org.apache.avalon.excalibur.collections
Interface Buffer

All Known Implementing Classes:
VariableSizeBuffer, FixedSizeBuffer

public interface Buffer

A Buffer is an ordered list of objects, that does not support querying or direct access to the elements. It is basically a First In/First Out (FIFO) buffer. It is useful in both pooling and queue implementation code among other things.

Since:
4.0
Version:
CVS $Revision: 1.1 $ $Date: 2001/12/21 13:43:57 $
Author:
Berin Loritsch

Method Summary
 void add(java.lang.Object o)
          Add an object into the buffer.
 boolean isEmpty()
          Tests to see if the CircularBuffer is empty.
 java.lang.Object remove()
          Removes the next object from the buffer.
 int size()
          Returns the number of elements stored in the buffer.
 

Method Detail

isEmpty

public boolean isEmpty()
Tests to see if the CircularBuffer is empty.

size

public int size()
Returns the number of elements stored in the buffer.

add

public void add(java.lang.Object o)
Add an object into the buffer.
Throws:
BufferOverflowException - if adding this element exceeds the buffer's capacity.

remove

public java.lang.Object remove()
Removes the next object from the buffer.
Throws:
BufferUnderflowException - if the buffer is already empty


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.