|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wso2.carbon.utils.logging.CircularBuffer<E>
public class CircularBuffer<E>
This is a Circular Buffer implementation. In this implementaion it is assumed that items will never be removed from this buffer. This can be used for a case such as a Rolling Log. A client can request the latest 'n' number of items that are stored in this buffer.
| Constructor Summary | |
|---|---|
CircularBuffer()
Create a circular buffer with the maximum allowed size |
|
CircularBuffer(int size)
Create a circular buffer with the given size |
|
| Method Summary | |
|---|---|
void |
append(E element)
Append elements while preserving the circular nature of the buffer. |
void |
clear()
Clear the circular buffer and reset the indices. |
List<E> |
get(int amount)
Retrieve the given amount of elements from the circular buffer. |
Object[] |
getObjects(int amount)
This method is added for backward compatibility. |
int |
getSize()
Return the capacity of the circular buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CircularBuffer(int size)
size - - fixed size of the bufferpublic CircularBuffer()
| Method Detail |
|---|
public void append(E element)
element - - element to be appendedpublic List<E> get(int amount)
amount - - no of elements to return
public Object[] getObjects(int amount)
amount - - amount of elements to return from the buffer
public void clear()
public int getSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||