|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ericsson.tic.vi.RawBuffer
public class RawBuffer
This is a buffer which stores char arrays. Buffer overflow leads to the oldest data beeing overwritten. The buffer is synchronized for writing only. Only one consumer is allowed. Consumer is assumed to read the full contents of the buffer before making another call to swap.
| Field Summary | |
|---|---|
private int |
capacity
The capacity/height of the buffer. |
private Object |
lock
Lock used for synchronizing the buffer while writing and swapping |
private int |
readFront
Pointer. |
private int |
readRear
Pointer. |
private char[][] |
readSide
The read side of the buffer. |
private char[][] |
temp
A temp. |
private int |
width
The width of the buffer. |
private int |
writeFront
Pointer. |
private int |
writeRear
Pointer. |
private char[][] |
writeSide
The write side of the buffer. |
| Constructor Summary | |
|---|---|
RawBuffer(int width,
int capacity)
Creates a new double-sided, circular, buffer. |
|
| Method Summary | |
|---|---|
void |
deposit(char[] line)
Deposits a line of text into the buffer on the write side. |
void |
deposit(char[] line,
int dataLength)
Deposits a line of text into the buffer on the write side. |
boolean |
empty()
Determine wheter the buffer is empty or not. |
char[] |
fetch()
Fetches a line of text from the read side of the buffer. |
int |
getWidth()
Get the width of this buffer. |
void |
swap()
Swaps the buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private char[][] writeSide
private char[][] readSide
private char[][] temp
private int width
private int capacity
private int readRear
private int writeRear
private int writeFront
private int readFront
private Object lock
| Constructor Detail |
|---|
public RawBuffer(int width,
int capacity)
width - The width of the buffer.capacity - Capacity of the buffer.| Method Detail |
|---|
public int getWidth()
public void swap()
public char[] fetch()
throws Exception
If - the buffer is empty.
Exceptionpublic boolean empty()
public void deposit(char[] line)
line - The line of text to be deposited.
public void deposit(char[] line,
int dataLength)
line - The line of text to be deposited.dataLength - The amount of characters to be read
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||