Package org.jmol.adapter.readers.spartan
Class SpartanUtil
- java.lang.Object
-
- org.jmol.adapter.readers.spartan.SpartanUtil
-
public class SpartanUtil extends Object
A class to isolate Spartan file reading methods from the rest of Jmol. Two public methods: getFileList and getData
-
-
Field Summary
Fields Modifier and Type Field Description FileManager
fm
-
Constructor Summary
Constructors Constructor Description SpartanUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javajs.util.SB
getData(InputStream is, String[] zipDirectory)
called by SmarterJmolAdapter via JmolUtil to open a Spartan directory and get all the needed data as a string.Object
getFileList(String name, boolean isTypeCheckOnly)
get a complete critical file list for a spartan file Mac directory based on file extension ".spardir.zip" or ".spardir"private String[]
getSpartanDirs(String outputFileData)
read the output file from the Spartan directory and decide from that what files need to be read and in what order - usually M0001 or a set of Profiles.private String[]
getSpartanFileList(String name, String[] dirNums)
returns the list of files to read for every Spartan spardir.SpartanUtil
set(FileManager fm)
private String[]
spartanFileList(String name, String outputFileData)
Special loading for file directories.private String
spartanGetObjectAsSections(String name, String header, Map<String,String> fileData)
delivers file contents and directory listing for a ZIP/JAR file into sb
-
-
-
Field Detail
-
fm
public FileManager fm
-
-
Method Detail
-
set
public SpartanUtil set(FileManager fm)
-
getFileList
public Object getFileList(String name, boolean isTypeCheckOnly)
get a complete critical file list for a spartan file Mac directory based on file extension ".spardir.zip" or ".spardir"- Parameters:
name
-isTypeCheckOnly
-- Returns:
- critical files list if just checking type or a buffered reader for a String containing all data
-
getData
public javajs.util.SB getData(InputStream is, String[] zipDirectory)
called by SmarterJmolAdapter via JmolUtil to open a Spartan directory and get all the needed data as a string.- Parameters:
is
-zipDirectory
-- Returns:
- String data for processing
-
spartanFileList
private String[] spartanFileList(String name, String outputFileData)
Special loading for file directories. This method is called from the FileManager via SmarterJmolAdapter. It's here because Resolver is the place where all distinctions are made. In the case of spt files, no need to load them; here we are just checking for type. In the case of .spardir directories, we need to provide a list of the critical files that need loading and concatenation for the SpartanSmolReader. we return an array for which: [0] file type (class prefix) or null for SPT file [1] header to add for each BEGIN/END block (ignored) [2...] files to load and concatenate- Parameters:
name
-outputFileData
-- Returns:
- array detailing action for this set of files
-
getSpartanDirs
private String[] getSpartanDirs(String outputFileData)
read the output file from the Spartan directory and decide from that what files need to be read and in what order - usually M0001 or a set of Profiles. But Spartan saves the Profiles in alphabetical order, not numerical. So we fix that here.- Parameters:
outputFileData
-- Returns:
- String[] list of files to read
-
getSpartanFileList
private String[] getSpartanFileList(String name, String[] dirNums)
returns the list of files to read for every Spartan spardir. Simple numbers are assumed to be Profiles; others are models.- Parameters:
name
-dirNums
-- Returns:
- String[] list of files to read given a list of directory names
-
-