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
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleancreateIndexFile(File indexFile, BinaryOfflineDataMapPoint mapPoint) protected voidfinalize()longintGet the number of objects stored in the current file.booleanopenNoiseFile(File anyOldFile) booleanopenOutputFiles(long dataTime) Open an output file.booleanopenPGDFFile(File outputFile) Open an output file.protected voidreOpen(long dataTime, long analTime, int endReason) booleanstoreData(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) booleanstoreData(DataOutputStream outputStream, int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) Writes data to a file.booleanwriteDatagram(Datagram datagram) Write a Datagram to an output streambooleanwriteFileFooter(BinaryFooter footer) Write a file footer to the binary output stream.booleanwriteFooter(long dataTime, long analTime, int endReason) booleanwriteHeader(long dataTime, long analTime) booleanbooleanwriteModuleFooter(byte[] footerData) Write module footer data to the output stream.booleanwriteModuleFooter(ModuleFooter moduleFooter) Write a module footer to the output stream.booleanwriteModuleFooter(DataOutputStream outputStream, byte[] footerData) Write module footer data to a specific output stream.booleanCalled just after datafiles are opened to put a header in the main output pgdf file.booleanwriteModuleHeader(byte[] headerData) Only writes module header to main pgdf file.booleanwriteModuleHeader(DataOutputStream outputStream, byte[] headerData)  
- 
Constructor Details
- 
BinaryOutputStream
 
 - 
 - 
Method Details
- 
finalize
 - 
reOpen
protected void reOpen(long dataTime, long analTime, int endReason)  - 
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.
 
 
 -