org.kc7bfi.jflac.util
Class RingBuffer

java.lang.Object
  extended by org.kc7bfi.jflac.util.RingBuffer

public class RingBuffer
extends java.lang.Object

RingBuffer class.


Constructor Summary
RingBuffer()
          Constructor.
RingBuffer(int size)
          Constructor.
 
Method Summary
 void empty()
          Empty the ring buffer.
 int get(byte[] data, int offset, int len)
          Read data from the ring buffer.
 int getAvailable()
          Return the bytes available for reading.
 boolean isEOF()
          Return EOF status.
static void main(java.lang.String[] args)
          Test main routine.
 void put(byte[] data, int offset, int len)
          Put data into the ring buffer.
 int putAvailable()
          return the space avaiable for writing.
 void resize(int newSize)
          Resize the ring buffer.
 void setEOF(boolean eof)
          Set the EOF status.
 int size()
          Return the size of the ring buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RingBuffer

public RingBuffer(int size)
Constructor.

Parameters:
size - The size of the ring buffer

RingBuffer

public RingBuffer()
Constructor.

Method Detail

size

public int size()
Return the size of the ring buffer.

Returns:
The ring buffer size

resize

public void resize(int newSize)
Resize the ring buffer.

Parameters:
newSize - The new size of the ring buffer

putAvailable

public int putAvailable()
return the space avaiable for writing.

Returns:
The byte that may be written to the ring buffer

empty

public void empty()
Empty the ring buffer.


put

public void put(byte[] data,
                int offset,
                int len)
Put data into the ring buffer.

Parameters:
data - The data to write
offset - The start position in the data array
len - The bytes from the data array to write

getAvailable

public int getAvailable()
Return the bytes available for reading.

Returns:
The number of bytes that may be read from the ring buffer

get

public int get(byte[] data,
               int offset,
               int len)
Read data from the ring buffer.

Parameters:
data - Where to put the data
offset - The offset into the data array to start putting data
len - The maximum data to read
Returns:
The number of bytes read

isEOF

public boolean isEOF()
Return EOF status.

Returns:
True if EOF.

setEOF

public void setEOF(boolean eof)
Set the EOF status.

Parameters:
eof - The eof to set.

main

public static void main(java.lang.String[] args)
Test main routine.

Parameters:
args - Not used