Package tritechgemini.fileio
Class GLFFileCatalog
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields inherited from class tritechgemini.fileio.GeminiFileCatalog
ARISEND, DATEND, ECDEND, GLFEND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuildCatalogue(ArrayList<GLFImageRecord> imageRecords) Catalogue the file.protected voidcheckDeserialisedCatalog(String filePath) Called just after a catalogue object has been deserialised, giving the opportunity to check anything.protected voidfinalize()booleanloadFullRecord(GLFImageRecord geminiRecord) fully load a record (if it isn't already).intreadGlfRecord(GLFImageRecord glfImage, DataInput dis, boolean readFully) Read a GLF record which may or may not have already been partially read.voidStop streaming the catalog.streamCatalog(CatalogStreamObserver streamObserver) Start a full forwards only read of the catalog from start to end, sending all records through to the streamObserver.voidwriteGLFHeader(GLFImageRecord glfRecord, LittleEndianDataOutputStream outputStream) Write an image record header.voidwriteGLFReecord(GLFImageRecord glfImage, LittleEndianDataOutputStream dos) Write a GLF record to the data output stream.voidwriteStatusHeader(GLFStatusData statusPacket, LittleEndianDataOutputStream outputStream) Write a status data header.voidwriteStatusRecord(GLFStatusData statusPacket, LittleEndianDataOutputStream outputStream) Methods inherited from class tritechgemini.fileio.GeminiFileCatalog
analyseCatalog, cDateToMillis, createCatalogue, findRecordForIDandTime, findRecordForIndexandTime, findRecordIndex, findRelativeRecord, freeAllImageData, freeImageData, getCatalogException, getCatalogName, getFileCatalog, getFilePath, getFirstRecordTime, getFullRecord, getImageRecords, getLastRecordTime, getMaxSonarFrames, getNumRecords, getNumSonars, getRecord, getRecordByIndex, getRecordIndex, getSonarIDs, getSonarInfo, getSonarRecord, getTimeZone, readSerializedCatalog, setImageRecords, setTimeZone, timedLoadFullRecord, writeSerializedCatalog
-
Constructor Details
-
GLFFileCatalog
-
-
Method Details
-
finalize
-
buildCatalogue
Description copied from class:GeminiFileCatalogCatalogue the file. i.e. go through the file and get the times and file positions of every record in the file.- Specified by:
buildCataloguein classGeminiFileCatalog<GLFImageRecord>- Parameters:
imageRecords-- Returns:
- true if catalog created successfully
- Throws:
Exception
-
loadFullRecord
Description copied from class:GeminiFileCatalogfully load a record (if it isn't already). This may involve going back to the file and getting and unpacking the raw data.- Specified by:
loadFullRecordin classGeminiFileCatalog<GLFImageRecord>- Parameters:
geminiRecord-- Returns:
- true if load sucessful.
- Throws:
IOException
-
writeGLFHeader
Write an image record header. Not 100% sure this is entirely accurate, but it has the main information and does create a valid GLF file.- Parameters:
glfRecord-outputStream-
-
writeStatusHeader
public void writeStatusHeader(GLFStatusData statusPacket, LittleEndianDataOutputStream outputStream) Write a status data header.- Parameters:
statusPacket-outputStream-
-
readGlfRecord
public int readGlfRecord(GLFImageRecord glfImage, DataInput dis, boolean readFully) throws CatalogException Read a GLF record which may or may not have already been partially read.- Parameters:
glfImage-dis-readFully-- Returns:
- 0 for a normal GLF record, 1 for file end, 2 for something else we didn't understand
- Throws:
CatalogException
-
writeGLFReecord
public void writeGLFReecord(GLFImageRecord glfImage, LittleEndianDataOutputStream dos) throws IOException Write a GLF record to the data output stream. This should be in the same format as the data were read in.- Parameters:
dos- Data output stream. Should be LittleEndienimageRecord- GLF image record- Throws:
IOException
-
writeStatusRecord
public void writeStatusRecord(GLFStatusData statusPacket, LittleEndianDataOutputStream outputStream) throws CatalogException - Throws:
CatalogException
-
streamCatalog
public CatalogStreamSummary streamCatalog(CatalogStreamObserver streamObserver) throws CatalogException Description copied from class:GeminiFileCatalogStart a full forwards only read of the catalog from start to end, sending all records through to the streamObserver.Whatever calls this will almost definitely want to do so in a separate worker thread because the call will block until the read has finished.
- Specified by:
streamCatalogin classGeminiFileCatalog<GLFImageRecord>- Parameters:
streamObserver- observer to get catalog data.- Returns:
- number of records read.
- Throws:
CatalogException
-
stopCatalogStream
public void stopCatalogStream()Description copied from class:GeminiFileCatalogStop streaming the catalog.- Specified by:
stopCatalogStreamin classGeminiFileCatalog<GLFImageRecord>
-
checkDeserialisedCatalog
Description copied from class:GeminiFileCatalogCalled just after a catalogue object has been deserialised, giving the opportunity to check anything. note that the file path is set elsewhere to allow for the possibility that the absolute path to the file may have changed, so it's probably not necessary to do anything here.- Specified by:
checkDeserialisedCatalogin classGeminiFileCatalog<GLFImageRecord>- Parameters:
filePath-
-