Class RAFCircularBuffer<T extends java.io.Serializable>


  • public class RAFCircularBuffer<T extends java.io.Serializable>
    extends java.lang.Object
    A persistent circular buffer system that uses a RandomAccessFile as the backing store.
    • 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 buffer
        sizeInKB - must be at least 1
        gzip - 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
      • _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)