Class BinaryDataSource

java.lang.Object
binaryFileStorage.BinaryDataSource
Direct Known Subclasses:
AISBinaryDataSource, ClickBinaryDataSource, ClipBinaryDataSource, CPODBinaryStore, DaqStatusBinaryStore, DbHtDataSource, DifarBinaryDataSource, DLDetectionBinarySource, DLResultBinarySource, FormsBinaryIO, GPLBinaryDataSource, GPLStateDataSource, GPSBinaryDataSource, IshBinaryDataSource, IshFnBinarySource, LtsaBinaryDataSource, NoiseBinaryDataSource, OneBandDataSource, RawDataBinaryDataSource, RWEBinaryDataSource, TriggerBackgroundBinarySource, WhistleBinaryDataSource

public abstract class BinaryDataSource extends Object
Not just a source, but also a sink for binary data from the binary store. Every BinaryDataSource is tied to a single PamDataBlock
Author:
Doug Gillespie
See Also:
  • Field Details Link icon

    • packSynchObject Link icon

      public static final Object packSynchObject
  • Constructor Details Link icon

    • BinaryDataSource Link icon

      public BinaryDataSource(PamDataBlock sisterDataBlock)
      Create a binary data source. These are used both to store data in binary files, and possibly also to send data to other PAMguard instances over the network.
      Parameters:
      sisterDataBlock - dataBlock for data to store / send
    • BinaryDataSource Link icon

      public BinaryDataSource(PamDataBlock sisterDataBlock, boolean doBinaryStore)
      Create a binary data source. These are used both to store data in binary files, and possibly also to send data to other PAMguard instances over the network.
      Parameters:
      sisterDataBlock - dataBlock for data to store / send
      doBinaryStore - true if data to be stored by default, false otherwise.
  • Method Details Link icon

    • getModuleType Link icon

      public String getModuleType()
      Returns:
      Module type to be stored in the file header
    • getModuleName Link icon

      public String getModuleName()
      Returns:
      Module name to be stored in the file header
    • getStreamName Link icon

      public abstract String getStreamName()
      Returns:
      Stream name to be stored in the file header
    • getStreamVersion Link icon

      public abstract int getStreamVersion()
      Returns:
      Stream version name to be stored in the Module Specific Control structure
    • getModuleVersion Link icon

      public abstract int getModuleVersion()
      Get a version number for the module.

      This is different to the version number in the main file header and allows individual modules to update their format and maintain backwards compatibility with old data

      Returns:
      integer module version number
    • getModuleHeaderData Link icon

      public abstract byte[] getModuleHeaderData()
      Returns:
      Additional information (e.g. a control structure for a detector) to be stored in the Module Specific Control structure
    • getModuleFooterData Link icon

      public byte[] getModuleFooterData()
      Returns:
      data for the binary footer, or null.
    • sinkData Link icon

      public abstract PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion)
      Convert data read back in in viewer mode into the correct type of PamDataUnit.

      DO NOT add this unit directly to the datablock, but pass it back to the calling process which will add it to the datablock if necessary.

      Parameters:
      binaryObjectData - Binary data read back from a file.
      bh - binary header from start of file.
      moduleVersion -
      Returns:
      the PamDataUnit created from these data
    • sinkModuleHeader Link icon

      public abstract ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh)
      Do something with module header information
      Parameters:
      binaryObjectData - data for the module header.
      bh - Binary header information
    • sinkModuleFooter Link icon

      public abstract ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader moduleHeader)
      Do something with module footer information
      Parameters:
      binaryObjectData - data for the module header.
      bh - Binary header information
    • setBinaryStorageStream Link icon

      public void setBinaryStorageStream(BinaryOutputStream binaryStorageStream)
      Parameters:
      binaryStorageStream - the binaryStorageStream to set
    • getBinaryStorageStream Link icon

      public BinaryOutputStream getBinaryStorageStream()
      Returns:
      the binaryStorageStream
    • createFilenamePrefix Link icon

      public String createFilenamePrefix()
      Creates the prefix for the binary store file names. Moved from the BinaryOutputStream class and changed to a public method so that it could be called by the binaryUIDFunctions object when searching for specific files
      Returns:
    • saveData Link icon

      public final boolean saveData(PamDataUnit pamDataUnit)
      Save new data into the binary stream
      Parameters:
      pamDataUnit -
    • getPackedData Link icon

      public abstract BinaryObjectData getPackedData(PamDataUnit pamDataUnit)
      Get packed binary data for either sending to file or over the network
      Parameters:
      pamDataUnit - data unit to pack
      Returns:
      packed binary data object
    • getSisterDataBlock Link icon

      public PamDataBlock getSisterDataBlock()
    • newFileOpened Link icon

      public abstract void newFileOpened(File outputFile)
      Called from the BinaryOutputStream whenever a new output file is opened.
      Parameters:
      outputFile - file information.
    • getSpecialDrawing Link icon

      public DataMapDrawing getSpecialDrawing()
      REturn a class capable of overriding the normal drawing on the data map
      Returns:
      null if nothign exists.
    • setDoBinaryStore Link icon

      public void setDoBinaryStore(boolean doBinaryStore)
      Parameters:
      doBinaryStore - the doBinaryStore to set This flag tells the binary store that this unit is available for binary storage. It's used mostly in raw data blocks which use this same class to write to a network socket but have the ability to wrote to the binary store disabled.
    • isDoBinaryStore Link icon

      public boolean isDoBinaryStore()
      Returns:
      the doBinaryStore
    • reset Link icon

      public void reset()
      Reset anything needing resetting in the binary data source. This get's called just before PamStart().
    • isStoreData Link icon

      public boolean isStoreData()
      Flag to say we want to actually store the data.
      Returns:
      the storeData
    • setStoreData Link icon

      public void setStoreData(boolean storeData)
      Flag to say we want to actually store the data.
      Parameters:
      storeData - the storeData to set
    • isSaveUpdates Link icon

      public boolean isSaveUpdates()
      Flag to say that updates should also be stored. this will cause a second record to be written to the binary file, so default response is false.
      Returns:
      the saveUpdates
    • setSaveUpdates Link icon

      public void setSaveUpdates(boolean saveUpdates)
      Flag to say that updates should also be stored. this will cause a second record to be written to the binary file, so default response is false.
      Parameters:
      saveUpdates - the saveUpdates to set
    • getBackgroundBinaryWriter Link icon

      public BackgroundBinaryWriter getBackgroundBinaryWriter()
      Returns:
      the backgroundBinaryWriter