edu.unh.sdb.datasource
Class BufferedOneDDataSink

java.lang.Object
  extended by edu.unh.sdb.datasource.DataSink
      extended by edu.unh.sdb.datasource.OneDDataSink
          extended by edu.unh.sdb.datasource.BufferedOneDDataSink

public class BufferedOneDDataSink
extends OneDDataSink


Field Summary
protected  java.nio.ByteBuffer buffer
           
protected  int byteArrayLength
           
protected  byte[] bytes
           
 
Fields inherited from class edu.unh.sdb.datasource.OneDDataSink
currentOffset
 
Fields inherited from class edu.unh.sdb.datasource.DataSink
axisWeights, bounds, datumSize, dimensionality, filename, numFields, ordering, raFile, recordDescriptor
 
Constructor Summary
BufferedOneDDataSink(java.lang.String filename, RecordDescriptor rd, int bufferSize)
          Constructs a one dimensional Datasink without specifying a bounds for the index space.
 
Method Summary
 void activate()
           
 void deactivate()
           
 void write(Datum d)
           
 void write(Datum d, IndexSpaceID id)
           
protected  void writeBuffer()
           
 
Methods inherited from class edu.unh.sdb.datasource.OneDDataSink
getBounds
 
Methods inherited from class edu.unh.sdb.datasource.DataSink
close, computeOffset, computeOffset, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

protected byte[] bytes

byteArrayLength

protected int byteArrayLength

buffer

protected java.nio.ByteBuffer buffer
Constructor Detail

BufferedOneDDataSink

public BufferedOneDDataSink(java.lang.String filename,
                            RecordDescriptor rd,
                            int bufferSize)
Constructs a one dimensional Datasink without specifying a bounds for the index space. If this constructor is used, then an IndexSpaceID cannot be passed to the write() method. Datums are simply written one after the other. This DataSink uses a buffer to store data in memory until an entire block of data can be written to disk. The bufferSize argument determines the size of this buffer, expressed as the number of datums than can be held.

Method Detail

activate

public void activate()
Overrides:
activate in class OneDDataSink

deactivate

public void deactivate()
Overrides:
deactivate in class DataSink

write

public void write(Datum d,
                  IndexSpaceID id)
Overrides:
write in class OneDDataSink

write

public void write(Datum d)
Overrides:
write in class OneDDataSink

writeBuffer

protected void writeBuffer()