Package net.simplace.sim.io
Class FileData
java.lang.Object
net.simplace.sim.io.FileData
- Author:
- Andreas Enders
-
Constructor Summary
ConstructorDescriptionFileData
(String aPathname, String aContent, FWSimSession aActiveInSession) FileData
(String aPathname, String aContent, FWSimSession aActiveInSession, String aDivider, String aProjectID) -
Method Summary
Modifier and TypeMethodDescriptionvoid
closes the file at the end of the writing or reading process. reset is called resetting the writer.boolean
String[][]
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.Element
If filename has changed or accessed for the first time the root element of the file are read from file system.boolean
void
void
setUpdated
(boolean aIsUpdated) toString()
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.void
writeStringsToFile
(Collection<String> aCollection) writes all strings to a file with given divider as one new line to the end of the opened file.void
writeToFile
(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
-