Package net.simplace.sim.io
Class FilePool
java.lang.Object
net.simplace.sim.io.FilePool
Has to be finalized before quitting the application
Reads from file system, out of zip-file and from class path or normal file access.
Can be used to efficiently access XML-files via Element (getRootElement) or CSV-Files via (getLinesOfFiles)
UpdateFileName will reset the caches only if the file name was changed in between. Read {
updateFileName(String, FWSimVarMap)
for more information.
The data will be cached for a second use. For memory optimization make sure to finalize the object accordingly- Author:
- Andreas Enders
-
Constructor Summary
ConstructorDescriptionFilePool
(String aFileName, String aContent, FWSimSession aCurrentSession, String aDivider, int aPoolSize, FWSimVariable.CONTENT_TYPE aContent_Type) -
Method Summary
Modifier and TypeMethodDescriptionvoid
finalize()
closes the file if content type is out and there is no more access to the fileboolean
registerFile
(FWSimVarMap aVarMap) toString()
-
Constructor Details
-
FilePool
public FilePool(String aFileName, String aContent, FWSimSession aCurrentSession, String aDivider, int aPoolSize, FWSimVariable.CONTENT_TYPE aContent_Type) - Parameters:
aFileName
-aCurrentSession
-aDivider
-aPoolSize
-aContent_Type
-
-
-
Method Details
-
registerFile
- Parameters:
aVarMap
-- Returns:
- the registered file data
-
getContentType
- Returns:
- type of content from
FWSimVariable.CONTENT_TYPE
-
finalize
public void finalize()closes the file if content type is out and there is no more access to the file -
toString
-
isInitialized
public boolean isInitialized()- Returns:
- check if Fileinfo is readily usable
-