Class BinaryInputStream

java.lang.Object
binaryFileStorage.BinaryInputStream

public class BinaryInputStream extends Object
Used to read data back from a binary data file and either send it off to the associated PamDataBlock or hand it back to the BinaryStore controller, e.g. for writing into a new file if data are being updated.
Author:
Doug Gillespie.
  • Constructor Details

  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • openFile

      protected boolean openFile(File inputFile)
      Open an input file for reading.
      Parameters:
      inputFile - file to open.
      Returns:
      true is successful.
    • closeFile

      protected void closeFile()
    • readHeader

      protected BinaryHeader readHeader()
      Reads the binary header from the file.
      Returns:
      a binary header or null if the header could not be read
    • readNextObject

      protected BinaryObjectData readNextObject(int fileFormat)
      Read the next object from the file.

      The object data will be packed up in a BinaryObjectData which will have various fields filled in depending on the type of object.

      null will be returned when there is an eof or when the file footer has been identified.

      The calling function can check the file was complete by testing whether or not the file footer is null.

      Parameters:
      fileFormat - Over-arching File format read from the file header for files and incorporated into additional header structures for network and other data.
      Returns:
      data object.
    • getBinaryFooter

      public BinaryFooter getBinaryFooter()
      Returns:
      the binaryFooter
    • getUnitsRead

      public int getUnitsRead()
      Returns:
      the unitsRead
    • getLastObjectTime

      public long getLastObjectTime()
      Returns:
      the lastObjectTime
    • getPamDataBlock

      public PamDataBlock getPamDataBlock()
      Returns:
      the pamDataBlock
    • getCurrentFile

      public File getCurrentFile()
      Returns:
      the currentFile