Package binaryFileStorage
Class BinaryOutputStream
java.lang.Object
binaryFileStorage.BinaryOutputStream
Handles writing of an actual binary data file.
Is used during data analysis and also to rewrite files if they are changed during offline analysis using the PAMGUARD viewer.
- Author:
- Doug Gillespie
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
createIndexFile
(File indexFile, BinaryOfflineDataMapPoint mapPoint) long
int
Get the number of objects stored in the current file.boolean
openNoiseFile
(File anyOldFile) boolean
openOutputFiles
(long dataTime) Open an output file.boolean
openPGDFFile
(File outputFile) Open an output file.boolean
storeData
(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) boolean
storeData
(DataOutputStream outputStream, int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) Writes data to a file.boolean
writeDatagram
(Datagram datagram) Write a Datagram to an output streamboolean
writeFileFooter
(BinaryFooter footer) Write a file footer to the binary output stream.boolean
writeFooter
(long dataTime, long analTime, int endReason) boolean
writeHeader
(long dataTime, long analTime) boolean
boolean
writeModuleFooter
(byte[] footerData) Write module footer data to the output stream.boolean
writeModuleFooter
(ModuleFooter moduleFooter) Write a module footer to the output stream.boolean
writeModuleFooter
(DataOutputStream outputStream, byte[] footerData) Write module footer data to a specific output stream.boolean
Called just after datafiles are opened to put a header in the main output pgdf file.boolean
writeModuleHeader
(byte[] headerData) Only writes module header to main pgdf file.boolean
writeModuleHeader
(DataOutputStream outputStream, byte[] headerData)
-
Constructor Details
-
BinaryOutputStream
-
-
Method Details
-
openOutputFiles
public boolean openOutputFiles(long dataTime) Open an output file.this call is used in real time ops to create a new file name based on the time and information from the datablock name.
- Parameters:
dataTime
- time in Java milliseconds- Returns:
- true if successful, false otherwise.
-
openPGDFFile
Open an output file.This version is also used when rewriting files when data have been changed offline. Generally the file will be a .tmp file
- Parameters:
outputFile
- output file- Returns:
- true if successful
-
openNoiseFile
-
closeFile
public boolean closeFile() -
writeHeader
public boolean writeHeader(long dataTime, long analTime) -
writeModuleHeader
public boolean writeModuleHeader()Called just after datafiles are opened to put a header in the main output pgdf file.- Returns:
- true if OK.
-
writeModuleHeader
public boolean writeModuleHeader(byte[] headerData) Only writes module header to main pgdf file.- Parameters:
headerData
-- Returns:
-
writeModuleHeader
-
getFileSize
public long getFileSize() -
storeData
public boolean storeData(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) -
storeData
public boolean storeData(DataOutputStream outputStream, int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) Writes data to a file. Note that the length of data may be greater than the actual length of useful data which is held in onjectLength- Parameters:
objectId
- unique object identifier.timeMillis
- time of object in java millisecondsdata
- byte array of binary data to store.objectLength
- length of useful data in data (often = data.length)- Returns:
- true if written successfully.
-
createIndexFile
public boolean createIndexFile() -
createIndexFile
-
writeDatagram
Write a Datagram to an output stream- Parameters:
datagram
-- Returns:
- true if successful.
- See Also:
-
getMainFileName
- Returns:
- the mainFileName
-
getStoredObjects
public int getStoredObjects()Get the number of objects stored in the current file.- Returns:
- the number of objects stored in the current file.
-