E - the generic Object to be storedpublic class CircularBuffer<E> extends Object
| Constructor and Description |
|---|
CircularBuffer(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
E |
get() |
E[] |
get(E[] into,
int length) |
E[] |
get(E[] into,
int readPos,
int length) |
E |
get(int readPos) |
boolean |
put(E element) |
int |
put(E[] newElements,
int length)
add multiple new elements
|
int |
put(E[] newElements,
int startIndex,
int length)
add multiple new elements
|
int |
remainingCapacity() |
void |
reset()
resets buffer
|
public CircularBuffer(int capacity)
capacity - maximum capacity of the bufferpublic int available()
public E get()
public E[] get(E[] into, int length)
into - storage containerlength - number of elements to be readpublic E[] get(E[] into, int readPos, int length)
into - storage containerreadPos - circular index (wraps around)length - number of elements to be readpublic E get(int readPos)
readPos - circular index (wraps around)public boolean put(E element)
element - new elementpublic int put(E[] newElements, int length)
newElements - array of new elementslength - number of elements that are to be written from arraypublic int put(E[] newElements, int startIndex, int length)
newElements - array of new elementsstartIndex - 'null'length - number of elements that are to be written from arraypublic int remainingCapacity()
public void reset()
Copyright © 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.