Package org.ptolemy.fmi
Class FMUFile
- java.lang.Object
-
- org.ptolemy.fmi.FMUFile
-
public class FMUFile extends java.lang.Object
Parse a Functional Mock-up Interface (FMI) 1.0 Functional Mock-up Unit (FMU) file and create a FMIModelDescription for later use.The parseFMUFile() method in this class is the primary entry point into this package.
FMI documentation may be found at http://www.modelisar.com/fmi.html.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$, $Id$
- Author:
- Christopher Brooks, Thierry S. Nouidui
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description FMUFile()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
fmuSharedLibrary(FMIModelDescription fmiModelDescription)
Return the name of the shared library from a .fmu file.static boolean
getIs32Bit()
Return true if this is a 32bit JVM.static FMIModelDescription
parseFMUFile(java.lang.String fmuFileName)
Read in a .fmu file and parse the modelDescription.xml file.static java.util.List<java.io.File>
unzip(java.lang.String zipFileName)
Unzip a file into a temporary directory.
-
-
-
Method Detail
-
fmuSharedLibrary
public static java.lang.String fmuSharedLibrary(FMIModelDescription fmiModelDescription) throws java.io.IOException
Return the name of the shared library from a .fmu file.- Parameters:
fmiModelDescription
- The representation of the model that was read in by {#parseFMUFile}.- Returns:
- The canonical path of the shared library.
- Throws:
java.io.IOException
- If thrown while determining the canonical path of the library.
-
parseFMUFile
public static FMIModelDescription parseFMUFile(java.lang.String fmuFileName) throws java.io.IOException
Read in a .fmu file and parse the modelDescription.xml file. If the same file has been previously read, then return the FMIModelDescription from that previous reading. Note that this does not load the shared library. That is loaded upon the first attempt to use the procedures in it. This is important because we want to be able to view a model that references an FMU even if the FMU does not support the current platform.- Parameters:
fmuFileName
- the .fmu file- Returns:
- An object that represents the structure of the modelDescriptionFile.xml file.
- Throws:
java.io.IOException
- If the file cannot be unzipped or the modelDescription.xml file contained by the fmuFileName zip file cannot be parsed.
-
unzip
public static java.util.List<java.io.File> unzip(java.lang.String zipFileName) throws java.io.IOException
Unzip a file into a temporary directory. Based on http://java.sun.com/developer/technicalArticles/Programming/compression/.- Parameters:
zipFileName
- The file to be unzipped.- Returns:
- the list of files that were extracted.
- Throws:
java.io.IOException
- if the file cannot be opened, if there are problems reading the zip file or if there are problems creating the files or directories.
-
getIs32Bit
public static boolean getIs32Bit()
Return true if this is a 32bit JVM.- Returns:
- true if this is a 32bit JVM.
-
-