Class RAFCircularBuffer<T extends java.io.Serializable>
- java.lang.Object
-
- com.inductiveautomation.ignition.common.util.RAFCircularBuffer<T>
-
public class RAFCircularBuffer<T extends java.io.Serializable> extends java.lang.Object
A persistent circular buffer system that uses aRandomAccessFile
as the backing store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RAFCircularBuffer.Filter<K>
-
Constructor Summary
Constructors Constructor Description RAFCircularBuffer(java.io.File file, int sizeInKB, boolean gzip)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Iterator<T>
_backwardIter()
Deprecated.java.util.Iterator<T>
_forwardIter()
Deprecated.void
close()
protected T
deserializeObject(java.io.InputStream stream)
void
exportBuffer(java.io.OutputStream outputStream)
long
getFileSize()
java.util.List<T>
iterateBackward(RAFCircularBuffer.Filter<? super T> filter)
java.util.List<T>
iterateForward(RAFCircularBuffer.Filter<T> filter)
static void
main(java.lang.String[] args)
void
reset()
protected void
serializeObject(T object, java.io.OutputStream stream)
Gives subclasses the chance to affect how data is written.void
write(T object)
-
-
-
Constructor Detail
-
RAFCircularBuffer
public RAFCircularBuffer(java.io.File file, int sizeInKB, boolean gzip) throws java.io.IOException
- Parameters:
file
- The file to use as the buffersizeInKB
- must be at least 1gzip
- A flag for whether or not new records should be stored with Gzip compression- Throws:
java.io.IOException
-
-
Method Detail
-
reset
public void reset()
-
getFileSize
public long getFileSize() throws java.io.IOException
- Throws:
java.io.IOException
-
exportBuffer
public void exportBuffer(java.io.OutputStream outputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
serializeObject
protected void serializeObject(T object, java.io.OutputStream stream) throws java.io.IOException
Gives subclasses the chance to affect how data is written. The provided stream will already be a GZIPOuputStream, if appropriate, and should not be closed in this function.- Throws:
java.io.IOException
-
deserializeObject
protected T deserializeObject(java.io.InputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
write
public void write(T object) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
iterateForward
public java.util.List<T> iterateForward(RAFCircularBuffer.Filter<T> filter)
-
iterateBackward
public java.util.List<T> iterateBackward(RAFCircularBuffer.Filter<? super T> filter)
-
_forwardIter
@Deprecated public java.util.Iterator<T> _forwardIter()
Deprecated.Do not use directly, not thread safe. Used for junit testing
-
_backwardIter
@Deprecated public java.util.Iterator<T> _backwardIter()
Deprecated.Do not use directly, not thread safe. Used for junit testing
-
main
public static void main(java.lang.String[] args)
-
-