visad.data.visad
Class BinaryReader

java.lang.Object
  extended by visad.data.visad.BinaryReader
All Implemented Interfaces:
BinaryFile

public class BinaryReader
extends Object
implements BinaryFile

Read a Data object in VisAD's binary format.

See Also:
Binary File Format Spec

Field Summary
 
Fields inherited from interface visad.data.visad.BinaryFile
DATA_DOUBLE_SET, DATA_FIELD, DATA_FLAT_FIELD, DATA_FLOAT_SET, DATA_GRIDDED_1D_DOUBLE_SET, DATA_GRIDDED_1D_SET, DATA_GRIDDED_2D_DOUBLE_SET, DATA_GRIDDED_2D_SET, DATA_GRIDDED_3D_DOUBLE_SET, DATA_GRIDDED_3D_SET, DATA_GRIDDED_SET, DATA_INTEGER_1D_SET, DATA_INTEGER_2D_SET, DATA_INTEGER_3D_SET, DATA_INTEGER_ND_SET, DATA_IRREGULAR_1D_SET, DATA_IRREGULAR_2D_SET, DATA_IRREGULAR_3D_SET, DATA_IRREGULAR_SET, DATA_LINEAR_1D_SET, DATA_LINEAR_2D_SET, DATA_LINEAR_3D_SET, DATA_LINEAR_LATLON_SET, DATA_LINEAR_ND_SET, DATA_LIST1D_SET, DATA_NONE, DATA_PRODUCT_SET, DATA_REAL, DATA_REAL_TUPLE, DATA_SINGLETON_SET, DATA_TEXT, DATA_TUPLE, DATA_UNION_SET, DEBUG_RD_CSYS, DEBUG_RD_DATA, DEBUG_RD_DATA_DETAIL, DEBUG_RD_ERRE, DEBUG_RD_MATH, DEBUG_RD_STR, DEBUG_RD_TIME, DEBUG_RD_UNIT, DEBUG_WR_CSYS, DEBUG_WR_DATA, DEBUG_WR_DATA_DETAIL, DEBUG_WR_ERRE, DEBUG_WR_MATH, DEBUG_WR_STR, DEBUG_WR_TIME, DEBUG_WR_UNIT, FLD_COORDSYS_SERIAL, FLD_DATA_SAMPLES, FLD_DELAUNAY, FLD_DELAUNAY_EDGES, FLD_DELAUNAY_NUM_EDGES, FLD_DELAUNAY_SERIAL, FLD_DELAUNAY_TRI, FLD_DELAUNAY_VERTICES, FLD_DELAUNAY_WALK, FLD_DOUBLE_SAMPLES, FLD_END, FLD_FIRSTS, FLD_FLOAT_LIST, FLD_FLOAT_SAMPLES, FLD_INDEX_COORDSYS, FLD_INDEX_ERROR, FLD_INDEX_ERRORS, FLD_INDEX_UNIT, FLD_INDEX_UNITS, FLD_INTEGER_SETS, FLD_LASTS, FLD_LENGTHS, FLD_LINEAR_SETS, FLD_RANGE_COORDSYSES, FLD_REAL_SAMPLES, FLD_SAMPLE, FLD_SET, FLD_SET_FOLLOWS_TYPE, FLD_SET_LIST, FLD_SET_SAMPLES, FLD_TRIVIAL_SAMPLES, FORMAT_VERSION, MAGIC_STR, MATH_FUNCTION, MATH_QUANTITY, MATH_REAL, MATH_REAL_TUPLE, MATH_SET, MATH_TEXT, MATH_TUPLE, OBJ_COORDSYS, OBJ_DATA, OBJ_DATA_SERIAL, OBJ_ERROR, OBJ_MATH, OBJ_MATH_SERIAL, OBJ_UNIT
 
Constructor Summary
BinaryReader(File ref)
          Open the referenced file.
BinaryReader(InputStream stream)
          Prepare to read a binary object from the specified stream.
BinaryReader(RandomAccessFile raf)
          Prepare to read a binary object from the specified stream.
BinaryReader(ucar.netcdf.RandomAccessFile raf)
          Prepare to read a binary object from the specified stream.
BinaryReader(String name)
          Open the named file.
 
Method Summary
 void close()
           
 BinaryObjectCache getCoordinateSystemCache()
           
 DataImpl getData()
           
 BinaryObjectCache getErrorEstimateCache()
           
 long getFilePointer()
           
 DataInput getInput()
           
 BinaryObjectCache getTypeCache()
           
 BinaryObjectCache getUnitCache()
           
static boolean isMagic(byte[] block)
           
 boolean isRandom()
           
 DataImpl readData()
           
 void seek(long pos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryReader

public BinaryReader(String name)
             throws IOException
Open the named file.

The first few bytes will be read to verify that the file starts with the appropriate MAGIC_STR characters and that this class can read the format version used by the file.

Parameters:
name - Name of file to be read.
Throws:
IOException - If the file cannot be opened.

BinaryReader

public BinaryReader(File ref)
             throws IOException
Open the referenced file.

The first few bytes will be read to verify that the file starts with the appropriate MAGIC_STR characters and that this class can read the format version used by the file.

Parameters:
ref - File to be read.
Throws:
IOException - If the file cannot be opened.

BinaryReader

public BinaryReader(InputStream stream)
             throws IOException
Prepare to read a binary object from the specified stream.

The first few bytes will be read to verify that the stream starts with the appropriate MAGIC_STR characters and that this class can read the format version used by the file.

Parameters:
stream - Stream to read.
Throws:
IOException - If the file cannot be opened.

BinaryReader

public BinaryReader(RandomAccessFile raf)
             throws IOException
Prepare to read a binary object from the specified stream.

The first few bytes will be read to verify that the stream starts with the appropriate MAGIC_STR characters and that this class can read the format version used by the file.

Parameters:
raf - File to read.
Throws:
IOException - If the file cannot be opened.

BinaryReader

public BinaryReader(ucar.netcdf.RandomAccessFile raf)
             throws IOException
Prepare to read a binary object from the specified stream.

The first few bytes will be read to verify that the stream starts with the appropriate MAGIC_STR characters and that this class can read the format version used by the file.

Parameters:
raf - File to read.
Throws:
IOException - If the file cannot be opened.
Method Detail

close

public void close()
           throws IOException
Throws:
IOException

getData

public DataImpl getData()
                 throws IOException,
                        VisADException
Throws:
IOException
VisADException

getCoordinateSystemCache

public final BinaryObjectCache getCoordinateSystemCache()

getErrorEstimateCache

public final BinaryObjectCache getErrorEstimateCache()

getFilePointer

public final long getFilePointer()
                          throws IOException
Throws:
IOException

getInput

public final DataInput getInput()

getTypeCache

public final BinaryObjectCache getTypeCache()

getUnitCache

public final BinaryObjectCache getUnitCache()

isMagic

public static boolean isMagic(byte[] block)

isRandom

public final boolean isRandom()

readData

public DataImpl readData()
                  throws IOException,
                         VisADException
Throws:
IOException
VisADException

seek

public final void seek(long pos)
                throws IOException
Throws:
IOException