edu.unh.sdb.datasource
Class BinaryFileDataSource

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataSource
          extended by edu.unh.sdb.datasource.PhysicalDataSource
              extended by edu.unh.sdb.datasource.BinaryFileDataSource
All Implemented Interfaces:
Indexable
Direct Known Subclasses:
AttributeOrderBFDS, PointOrderBFDS

public abstract class BinaryFileDataSource
extends PhysicalDataSource

This class will read from a file of binary data, providing an n-dimensional datasource view of that file. For the moment, we'll assume that all data is in big-endian Java Native format.


Field Summary
protected  IntegerIndexSpaceID bufferIterCopy
           
protected  IndexSpaceID bufferUpper
           
protected  IndexSpaceID dimensions
           
protected  java.nio.channels.FileChannel fChannel
           
protected  long iniOffset
           
protected  IntegerIndexSpaceID iterCopy
           
protected  int leastSignificantAxis
           
protected  java.io.RandomAccessFile raFile
           
protected  int recordByteSize
           
protected  int recordNumFields
           
protected  int srcRodByteSize
           
protected  int srcRodSize
           
protected  int[] steps
           
protected  Datum tempDatum
           
 
Fields inherited from class edu.unh.sdb.datasource.PhysicalDataSource
BIG_ENDIAN, bufferBounds, bufferDimension, bufferSteps, byteBuffers, directMemoryLimit, endian, LITTLE_ENDIAN, maxBufferSize, maxGapSize, readCounter, readLength, url
 
Fields inherited from class edu.unh.sdb.datasource.DataSource
fdlDescriptor, isActivated, name, wsName
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
BinaryFileDataSource(java.lang.String name, RecordDescriptor recordDesc, ISBounds theBounds, AxisOrdering ordering, java.lang.String URL, java.nio.ByteOrder endian)
          create a BinaryFileDataSource, set the initial file offset at 0
BinaryFileDataSource(java.lang.String name, RecordDescriptor recordDesc, ISBounds theBounds, AxisOrdering ordering, java.lang.String URL, java.nio.ByteOrder endian, int offset)
          crate a BinaryFileDataSource, set the initial file offset at the given value
 
Method Summary
 void activate()
          Open the binary data file for this datasource.
static BinaryFileDataSource createBinaryFileDataSource(java.lang.String name, RecordDescriptor recordDesc, ISBounds theBounds, AxisOrdering ordering, java.lang.String URL, java.nio.ByteOrder endian, int dataOrder)
          Deprecated. use DataSource.create()
 void deactivate()
          Close the binary data file for this datasource, and the file can not be reopened
 boolean equals(java.lang.Object o)
          Returns true if this BinaryFileDataSource has the same pointOrder as the argument BinaryFileDataSource, as well as meeting inherited criteria for equality.
 long getFileOffset()
          get the file initial offset
static void main(java.lang.String[] args)
           
protected  void setDatum(int i, int storageType, Datum datum, java.nio.ByteBuffer buffer)
          this method is used by both AttributeOrderBFDS and PointOrderBFDS in Datum methods This method will replace setDatum(int i, int storageType, Datum datum ), and used java.14 byteBuffer
 void setFileOffset(long offset)
          set the file initial offset
 java.lang.String toString()
          Print the data members of the DataSource in an easy to read fashion.
 
Methods inherited from class edu.unh.sdb.datasource.PhysicalDataSource
allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, allocateBuffer, deleteBuffer, deleteBuffer, deleteBuffers, getBuffer, getBuffer, getBufferSize, getBufferSize, getByteOrder, getDataFileString, getMaxBufferSize, getReadCounter, getReadLength, getURL, initializeBuffers, isBigEndian, makeBestBuffer, resetReadCounter, setBufferByteOrder, setMaxBufferSize, setMaxGapSize, subblock, subblock, subblock, toString
 
Methods inherited from class edu.unh.sdb.datasource.DataSource
checkActivated, clearCache, copyBestID, create, create, create, createRemote, createRemote, createRemoteClient, createRemoteClient, createRemoteDataSource, createRemoteDataSource, createRemoteDataSourceUDP, createRemoteUDP, createRemoteUDP, dumpData, getName, getValues, isActivated
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, datum, datum, datum, datum, datum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

raFile

protected java.io.RandomAccessFile raFile

fChannel

protected java.nio.channels.FileChannel fChannel

steps

protected int[] steps

leastSignificantAxis

protected int leastSignificantAxis

recordByteSize

protected int recordByteSize

recordNumFields

protected int recordNumFields

tempDatum

protected Datum tempDatum

iterCopy

protected IntegerIndexSpaceID iterCopy

bufferIterCopy

protected IntegerIndexSpaceID bufferIterCopy

dimensions

protected IndexSpaceID dimensions

bufferUpper

protected IndexSpaceID bufferUpper

iniOffset

protected long iniOffset

srcRodSize

protected int srcRodSize

srcRodByteSize

protected int srcRodByteSize
Constructor Detail

BinaryFileDataSource

public BinaryFileDataSource(java.lang.String name,
                            RecordDescriptor recordDesc,
                            ISBounds theBounds,
                            AxisOrdering ordering,
                            java.lang.String URL,
                            java.nio.ByteOrder endian)
create a BinaryFileDataSource, set the initial file offset at 0


BinaryFileDataSource

public BinaryFileDataSource(java.lang.String name,
                            RecordDescriptor recordDesc,
                            ISBounds theBounds,
                            AxisOrdering ordering,
                            java.lang.String URL,
                            java.nio.ByteOrder endian,
                            int offset)
crate a BinaryFileDataSource, set the initial file offset at the given value

Method Detail

activate

public void activate()
Open the binary data file for this datasource.

Overrides:
activate in class DataSource

deactivate

public void deactivate()
Close the binary data file for this datasource, and the file can not be reopened

Overrides:
deactivate in class PhysicalDataSource

setFileOffset

public void setFileOffset(long offset)
set the file initial offset


getFileOffset

public long getFileOffset()
get the file initial offset


setDatum

protected void setDatum(int i,
                        int storageType,
                        Datum datum,
                        java.nio.ByteBuffer buffer)
this method is used by both AttributeOrderBFDS and PointOrderBFDS in Datum methods This method will replace setDatum(int i, int storageType, Datum datum ), and used java.14 byteBuffer


toString

public java.lang.String toString()
Print the data members of the DataSource in an easy to read fashion.

Overrides:
toString in class PhysicalDataSource

equals

public boolean equals(java.lang.Object o)
Returns true if this BinaryFileDataSource has the same pointOrder as the argument BinaryFileDataSource, as well as meeting inherited criteria for equality.

Overrides:
equals in class PhysicalDataSource

createBinaryFileDataSource

public static BinaryFileDataSource createBinaryFileDataSource(java.lang.String name,
                                                              RecordDescriptor recordDesc,
                                                              ISBounds theBounds,
                                                              AxisOrdering ordering,
                                                              java.lang.String URL,
                                                              java.nio.ByteOrder endian,
                                                              int dataOrder)
Deprecated. use DataSource.create()

create a BinaryFileDataSource, set the initial file offset at 0 this is only used for remove compiling errors.


main

public static void main(java.lang.String[] args)