Package binaryFileStorage
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
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 Summary
-
Constructor Summary
ConstructorDescriptionBinaryDataSource
(PamDataBlock sisterDataBlock) Create a binary data source.BinaryDataSource
(PamDataBlock sisterDataBlock, boolean doBinaryStore) Create a binary data source. -
Method Summary
Modifier and TypeMethodDescriptionCreates the prefix for the binary store file names.byte[]
abstract byte[]
abstract int
Get a version number for the module.abstract BinaryObjectData
getPackedData
(PamDataUnit pamDataUnit) Get packed binary data for either sending to file or over the networkREturn a class capable of overriding the normal drawing on the data mapabstract String
abstract int
boolean
boolean
Flag to say that updates should also be stored.boolean
Flag to say we want to actually store the data.abstract void
newFileOpened
(File outputFile) Called from the BinaryOutputStream whenever a new output file is opened.void
reset()
Reset anything needing resetting in the binary data source.final boolean
saveData
(PamDataUnit pamDataUnit) Save new data into the binary streamvoid
setBinaryStorageStream
(BinaryOutputStream binaryStorageStream) void
setDoBinaryStore
(boolean doBinaryStore) void
setSaveUpdates
(boolean saveUpdates) Flag to say that updates should also be stored.void
setStoreData
(boolean storeData) Flag to say we want to actually store the data.abstract PamDataUnit
sinkData
(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion) Convert data read back in in viewer mode into the correct type of PamDataUnit.abstract ModuleFooter
sinkModuleFooter
(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader moduleHeader) Do something with module footer informationabstract ModuleHeader
sinkModuleHeader
(BinaryObjectData binaryObjectData, BinaryHeader bh) Do something with module header information
-
Field Details
-
packSynchObject
-
-
Constructor Details
-
BinaryDataSource
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
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 / senddoBinaryStore
- true if data to be stored by default, false otherwise.
-
-
Method Details
-
getModuleType
- Returns:
- Module type to be stored in the file header
-
getModuleName
- Returns:
- Module name to be stored in the file header
-
getStreamName
- Returns:
- Stream name to be stored in the file header
-
getStreamVersion
public abstract int getStreamVersion()- Returns:
- Stream version name to be stored in the Module Specific Control structure
-
getModuleVersion
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
public abstract byte[] getModuleHeaderData()- Returns:
- Additional information (e.g. a control structure for a detector) to be stored in the Module Specific Control structure
-
sinkData
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
Do something with module header information- Parameters:
binaryObjectData
- data for the module header.bh
- Binary header information
-
setBinaryStorageStream
- Parameters:
binaryStorageStream
- the binaryStorageStream to set
-
getBinaryStorageStream
- Returns:
- the binaryStorageStream
-
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
Save new data into the binary stream- Parameters:
pamDataUnit
-
-
getPackedData
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
-
newFileOpened
Called from the BinaryOutputStream whenever a new output file is opened.- Parameters:
outputFile
- file information.
-
getSpecialDrawing
REturn a class capable of overriding the normal drawing on the data map- Returns:
- null if nothign exists.
-
setDoBinaryStore
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
public boolean isDoBinaryStore()- Returns:
- the doBinaryStore
-
reset
public void reset()Reset anything needing resetting in the binary data source. This get's called just before PamStart(). -
isStoreData
public boolean isStoreData()Flag to say we want to actually store the data.- Returns:
- the storeData
-
setStoreData
public void setStoreData(boolean storeData) Flag to say we want to actually store the data.- Parameters:
storeData
- the storeData to set
-
isSaveUpdates
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
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
- Returns:
- the backgroundBinaryWriter
-