|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.util.CircularBuffer
A fixed-capacity circular buffer class for byte-stream data. This class is thread-safe.
| Constructor Summary | |
CircularBuffer(int capacity_)
|
|
| Method Summary | |
int |
append(byte[] data_)
Appends data to circular buffers. |
int |
append(byte[] data_,
int length_)
Appends data to circular buffers. |
int |
append(byte[] data_,
int offset_,
int length_)
Appends data to circular buffers. |
void |
duplicate(java.lang.Object source_)
opies the content of the source_ object to this object. |
int |
getAvailableSpace()
|
int |
getCapacity()
|
int |
getSize()
returns the (occupied) size of the circular buffer |
int |
insert(byte[] data_,
int pos_,
int length_)
Inserts data to circular buffers. |
int |
insert(byte[] data_,
int pos_,
int dataOffset_,
int length_)
Inserts data to circular buffers. |
byte[] |
read(int start_,
int len_)
Reads but not removes data from the buffer |
int |
remove(byte[] buf_,
int size_)
Removes bytes from the circular buffer to the specified buffer. |
int |
remove(byte[] buf_,
int pos_,
int size_)
Removes bytes from the circular buffer to the specified buffer. |
byte[] |
remove(int size_)
Removes data from the circular buffer. |
void |
reset()
|
void |
resize(int newSize_,
boolean shrink_)
|
java.lang.String |
toString()
|
| Methods inherited from class drcl.DrclObj |
clone |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public CircularBuffer(int capacity_)
capacity - size of the circular buffer.| Method Detail |
public void reset()
public void duplicate(java.lang.Object source_)
DrclObjsource_ object to this object.
he subclass must implement this method to realize DrclObj.clone().duplicate in class DrclObjpublic int append(byte[] data_)
public int append(byte[] data_,
int length_)
public int append(byte[] data_,
int offset_,
int length_)
data_ may be null and the buffer still
allocates length_ bytes but
no data is actually written to the buffer.
Nothing is allocated if the buffer capacity would be exceeded or
data_ is not null but length_ is greater
than the length of data_.offset_ - starting position in data_.
public int insert(byte[] data_,
int pos_,
int length_)
pos_ - starting position in data_.
public int insert(byte[] data_,
int pos_,
int dataOffset_,
int length_)
data_ may be null and the buffer still
allocates length_ bytes but
no data is actually written to the buffer.
Nothing is allocated if the buffer capacity would be exceeded or
data_ is not null but length_ is greater
than the length of data_.pos_ - starting position in data_.dataOffset_ - offset in data_.public byte[] remove(int size_)
size_ - # of bytes to be removed from the buffer; removes all if size is
less than 0.
public int remove(byte[] buf_,
int size_)
size_ - # of bytes to be removed from the buffer; removes all if size is
less than 0.
public int remove(byte[] buf_,
int pos_,
int size_)
size_ - # of bytes to be removed from the buffer; removes all if size is
less than 0.pos_ - starting position in buf_.
public byte[] read(int start_,
int len_)
public int getSize()
public int getCapacity()
public int getAvailableSpace()
public java.lang.String toString()
toString in class DrclObj
public void resize(int newSize_,
boolean shrink_)
|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||