Package org.jmol.adapter.readers.spartan
Class SpartanUtil
java.lang.Object
org.jmol.adapter.readers.spartan.SpartanUtil
A class to isolate Spartan file reading methods from the rest of Jmol.
Two public methods: getFileList and getData
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
getAllZipData
(InputStream is, String[] subfileList, String name0, String binaryFileList, String exclude, Map<String, String> fileData) reads a ZIP file and saves all data in a Hashtable so that the files may be organized later in a different order.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.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.set
(FileManager fm) private String[]
spartanFileList
(String name, String outputFileData) Special loading for file directories.private String
delivers file contents and directory listing for a ZIP/JAR file into sb
-
Field Details
-
fm
-
-
Constructor Details
-
SpartanUtil
public SpartanUtil()
-
-
Method Details
-
set
-
getFileList
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
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
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
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
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
-
spartanGetObjectAsSections
delivers file contents and directory listing for a ZIP/JAR file into sb- Parameters:
name
-header
-fileData
-- Returns:
- name of entry
-
getAllZipData
private void getAllZipData(InputStream is, String[] subfileList, String name0, String binaryFileList, String exclude, Map<String, String> fileData) reads a ZIP file and saves all data in a Hashtable so that the files may be organized later in a different order. Also adds a #Directory_Listing entry. Files are bracketed by BEGIN Directory Entry and END Directory Entry lines, similar to CompoundDocument.getAllData.- Parameters:
is
-subfileList
-name0
- prefix for entry listingbinaryFileList
- |-separated list of files that should be saved as xx xx xx hex byte strings. The directory listing is appended with ":asBinaryString"exclude
-fileData
-
-