gr.uoa.di.madgik.searchlibrary.operatorlibrary.indexfuse
Class DiskBuffer

java.lang.Object
  extended by gr.uoa.di.madgik.searchlibrary.operatorlibrary.indexfuse.DiskBuffer

public class DiskBuffer
extends Object

Class used to wrap a file buffer for the records that are beeing processed

Author:
UoA

Field Summary
 long rtime
          Time it took to read
 long wtime
          Time it took to write
 
Constructor Summary
DiskBuffer(String filename, boolean flag)
          Creates a new DiskBuffer
 
Method Summary
 void clear()
          Clears the underlying structs
 void close()
          Closes the underlying file stream
 FilePosition persist(gr.uoa.di.madgik.grs.record.Record rec)
          Persists the provided record
 gr.uoa.di.madgik.grs.record.Record retrieve(FilePosition pos)
          Retrieves the record from the given position
 Vector<gr.uoa.di.madgik.grs.record.Record> retrieve(Vector<FilePosition> pos)
          Retrieves the records in teh given possitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wtime

public long wtime
Time it took to write


rtime

public long rtime
Time it took to read

Constructor Detail

DiskBuffer

public DiskBuffer(String filename,
                  boolean flag)
           throws Exception
Creates a new DiskBuffer

Parameters:
filename - The name of the file to use
flag - iftrue The file is opened for writing, otherwise for reading
Throws:
Exception - An unrecoverable for the operation error occured
Method Detail

persist

public FilePosition persist(gr.uoa.di.madgik.grs.record.Record rec)
                     throws Exception
Persists the provided record

Parameters:
rec - The record to persist
Returns:
The position in the file buffer
Throws:
Exception - An unrecoverable for the operation error occured

close

public void close()
           throws Exception
Closes the underlying file stream

Throws:
Exception - An unrecoverable for the operation error occured

retrieve

public Vector<gr.uoa.di.madgik.grs.record.Record> retrieve(Vector<FilePosition> pos)
                                                    throws Exception
Retrieves the records in teh given possitions

Parameters:
pos - Teh possition to read from
Returns:
Teh records retrieved
Throws:
Exception - An unrecoverable for the operation error occured

retrieve

public gr.uoa.di.madgik.grs.record.Record retrieve(FilePosition pos)
                                            throws Exception
Retrieves the record from the given position

Parameters:
pos - The position to retrieve the record from
Returns:
The retrieved record
Throws:
Exception - An unrecoverable for the operation error occured

clear

public void clear()
Clears the underlying structs



Copyright © 2013. All Rights Reserved.