iterator
Class IoBuf

java.lang.Object
  extended byiterator.IoBuf
All Implemented Interfaces:
GlobalConst

public class IoBuf
extends java.lang.Object
implements GlobalConst


Field Summary
static int READ_BUFFER
           
static int WRITE_BUFFER
           
 
Fields inherited from interface global.GlobalConst
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF
 
Constructor Summary
IoBuf()
           
 
Method Summary
 long flush()
          returns the numbers of tuples written
 Tuple Get(Tuple buf)
          get a tuple from current buffer,pass reference buf to this method usage:temp_tuple = tuple.Get(buf);
 void init(byte[][] bufs, int n_pages, int tSize, Heapfile temp_fd)
          Initialize some necessary inormation, call Iobuf to create the object, and call init to finish instantiation
 void IoBuf()
          Constructor - use init to initialize.
 void Put(Tuple buf)
          Writes a tuple to the output buffer
 void reread()
          if WRITE_BUFFER is true, call this mehtod to switch to read buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITE_BUFFER

public static final int WRITE_BUFFER
See Also:
Constant Field Values

READ_BUFFER

public static final int READ_BUFFER
See Also:
Constant Field Values
Constructor Detail

IoBuf

public IoBuf()
Method Detail

IoBuf

public void IoBuf()
Constructor - use init to initialize.


init

public void init(byte[][] bufs,
                 int n_pages,
                 int tSize,
                 Heapfile temp_fd)
Initialize some necessary inormation, call Iobuf to create the object, and call init to finish instantiation

Parameters:
n_pages - the number of pages of this buffer
tSize - the page size the size of tuple being stored here; i.e., Tuple.size()
temp_fd - the reference to a Heapfile

Put

public void Put(Tuple buf)
         throws NoOutputBuffer,
                java.io.IOException,
                java.lang.Exception
Writes a tuple to the output buffer

Parameters:
buf - the tuple written to buffer
Throws:
NoOutputBuffer - the buffer is a input bufer now
java.io.IOException - some I/O fault
java.lang.Exception - other exceptions

Get

public Tuple Get(Tuple buf)
          throws java.io.IOException,
                 java.lang.Exception
get a tuple from current buffer,pass reference buf to this method usage:temp_tuple = tuple.Get(buf);

Parameters:
buf - write the result to buf
Returns:
the result tuple
Throws:
java.io.IOException - some I/O fault
java.lang.Exception - other exceptions

flush

public long flush()
           throws java.io.IOException,
                  java.lang.Exception
returns the numbers of tuples written

Returns:
the numbers of tuples written
Throws:
java.io.IOException - some I/O fault
java.lang.Exception - other exceptions

reread

public void reread()
            throws java.io.IOException,
                   java.lang.Exception
if WRITE_BUFFER is true, call this mehtod to switch to read buffer.

Throws:
java.io.IOException - some I/O fault
java.lang.Exception - other exceptions