Package gda.data.scan.datawriter
Class IncrementalFile
java.lang.Object
gda.data.scan.datawriter.DataWriterBase
gda.data.scan.datawriter.IncrementalFile
- All Implemented Interfaces:
DataWriter,IDataWriterExtender
- Direct Known Subclasses:
AsciiDataWriter,SrsDataFile
This class is for writing ascii files of tabulated data, with a header and footer.
This class is abstract as it does not dictate the format used when writing to the file.
The files created use names which are an increment from the last name. Files are named in the format 0001.dat
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected FileWriterprotected Stringprotected Stringprotected booleanprotected Stringprotected Stringprotected booleanprotected intFields inherited from class gda.data.scan.datawriter.DataWriterBase
delimiter, header, terminalPrinter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWrites any file footers and closes file.voidconfigureScanNumber(int scanNumber) If filenumber not set then read from scandatapoint or from num trackervoidCloses current file and opens a new file with an incremental number.voiddestroy()Close down the file.Get the absFilePath for this scanintGet the current scan identifier (ie scan number)Returns the full path of the folder which data files are written to.Get the delimiter used between columnsintReturns the number of the last file written to.voidOpen files and writes out headers.voidReleases the file handle.voidsetDelimiter(String delimiter) Set the delimiter used between columns (default is a tab '\t')voidsetFilePrefix(String filePrefix) abstract voidThis should be extended by inheriting classes.abstract voidThis should be extended by inheriting classes.abstract voidThis should be extended by inheriting classes.Methods inherited from class gda.data.scan.datawriter.DataWriterBase
addData, addData, addDataWriterExtender, completeCollection, getDetectorData, getDetectorData, getHeader, removeDataWriterExtender, setHeaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.data.scan.datawriter.DataWriter
scanStart, setHeader
-
Field Details
-
thisFileNumber
protected int thisFileNumber -
fileNumberConfigured
protected boolean fileNumberConfigured -
fileExtension
-
filePrefix
-
dataDir
-
file
-
fileName
-
fileUrl
-
firstData
protected boolean firstData -
currentFileName
-
-
Constructor Details
-
IncrementalFile
public IncrementalFile()Constructor which determines the name of the next file.
-
-
Method Details
-
destroy
public void destroy()Close down the file. -
prepareForCollection
Open files and writes out headers.- Throws:
Exception
-
completeCollection
Writes any file footers and closes file.- Specified by:
completeCollectionin interfaceDataWriter- Overrides:
completeCollectionin classDataWriterBase- Throws:
Exception
-
configureScanNumber
Description copied from class:DataWriterBaseIf filenumber not set then read from scandatapoint or from num tracker- Specified by:
configureScanNumberin interfaceDataWriter- Overrides:
configureScanNumberin classDataWriterBase- Parameters:
scanNumber-- Throws:
Exception
-
setFilePrefix
-
createNextFile
Closes current file and opens a new file with an incremental number. For use when many files being created instead of a single file being appended to.- Throws:
Exception
-
releaseFile
public void releaseFile()Releases the file handle. -
writeHeader
public abstract void writeHeader()This should be extended by inheriting classes. -
writeColumnHeadings
public abstract void writeColumnHeadings()This should be extended by inheriting classes. -
getDataDir
Returns the full path of the folder which data files are written to.- Returns:
- the full path of the folder which data files are written
-
getDelimiter
Get the delimiter used between columns- Returns:
- the delimiter used between columns
-
setDelimiter
Set the delimiter used between columns (default is a tab '\t')- Parameters:
delimiter- String
-
getFileNumber
Returns the number of the last file written to.- Returns:
- Long
- Throws:
Exception
-
getCurrentFileName
Description copied from interface:DataWriterGet the absFilePath for this scan- Returns:
- String
-
getCurrentScanIdentifier
public int getCurrentScanIdentifier()Description copied from interface:DataWriterGet the current scan identifier (ie scan number)- Returns:
- String
-