Package net.simplace.sim.io
Class FileData
java.lang.Object
net.simplace.sim.io.FileData
- Author:
- Andreas Enders
-
Constructor Summary
ConstructorsConstructorDescriptionFileData(String aPathname, String aContent, FWSimSession aActiveInSession) FileData(String aPathname, String aContent, FWSimSession aActiveInSession, String aDivider, String aProjectID) -
Method Summary
Modifier and TypeMethodDescriptionvoidcloses the file at the end of the writing or reading process. reset is called resetting the writer.booleanString[][]getDataCache(Integer[] aLinesToRead, Integer aSkipHeaderLines) If filename has changed or accessed for the first time the lines of the file are read from file system.getFile()org.jdom2.ElementIf filename has changed or accessed for the first time the root element of the file are read from file system.booleanvoidvoidsetUpdated(boolean aIsUpdated) toString()voidwriteObjectsToFile(Collection<Object> aCollection, LinkedHashMap<String, FWSimVariable<?>> aHeaderVariables, CSVInterface.DATA_MODE aDataMode) writes all objects to a file with given divider as one new line to the end of the opened file.voidwriteStringsToFile(Collection<String> aCollection) writes all strings to a file with given divider as one new line to the end of the opened file.voidwriteToFile(String aLine) writes all strings to a file with given divider as one new line to the end of the opened file.
-
Constructor Details
-
FileData
public FileData(String aPathname, String aContent, FWSimSession aActiveInSession, String aDivider, String aProjectID) - Parameters:
aPathname-aActiveInSession-aDivider-aProjectID-aLinesToRead-
-
FileData
- Parameters:
aPathname-aActiveInSession-aLinesToRead-
-
-
Method Details
-
setCache
- Parameters:
aFileData-aWasUpdated-
-
getDataCache
If filename has changed or accessed for the first time the lines of the file are read from file system. If not they are just returned without reading again.- Parameters:
aLinesToRead-aSkipHeaderLines-- Returns:
- Vector of lines in the file in the given order
- Throws:
IOException
-
getRootElement
If filename has changed or accessed for the first time the root element of the file are read from file system. If not it is just returned without reading again.- Returns:
- root element from xml file
- Throws:
IOException
-
writeStringsToFile
writes all strings to a file with given divider as one new line to the end of the opened file.- Parameters:
aCollection-
-
writeObjectsToFile
public void writeObjectsToFile(Collection<Object> aCollection, LinkedHashMap<String, FWSimVariable<?>> aHeaderVariables, CSVInterface.DATA_MODE aDataMode) writes all objects to a file with given divider as one new line to the end of the opened file. For a null object the String "NULL" is writtenor 12.2363452 ==> 12.24 - Parameters:
aCollection-aHeaderVariables-
-
writeToFile
writes all strings to a file with given divider as one new line to the end of the opened file.- Parameters:
aLine-
-
getSession
- Returns:
- the activeInSession
-
closeFile
public void closeFile()closes the file at the end of the writing or reading process. reset is called resetting the writer. -
setUpdated
public void setUpdated(boolean aIsUpdated) -
isUpdated
public boolean isUpdated() -
getFile
-
getUniqueID
-
equals
-
toString
-