public class ZipUtil extends Object implements JmolZipUtility
| Constructor and Description |
|---|
ZipUtil() |
| Modifier and Type | Method and Description |
|---|---|
void |
addZipEntry(Object zos,
String fileName) |
boolean |
cachePngjFile(FileManager fm,
String[] data) |
String |
cacheZipContents(BufferedInputStream bis,
String fileName,
Map<String,byte[]> cache)
caches an entire pngj file's contents into a Map
|
private static javajs.util.SB |
checkSpecialData(InputStream is,
String[] zipDirectory)
called by SmarterJmolAdapter to see if we have a Spartan directory and, if
so, open it and get all the data into the correct order.
|
(package private) static String[] |
checkSpecialInZip(String[] zipDirectory)
called by SmarterJmolAdapter to see if we can automatically assign a file
from the zip file.
|
void |
closeZipEntry(Object zos) |
void |
getAllZipData(InputStream is,
String[] subfileList,
String name0,
String binaryFileList,
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.
|
private static void |
getAllZipDataStatic(InputStream is,
String[] subfileList,
String name0,
String binaryFileList,
Map<String,String> fileData) |
Object |
getAtomSetCollectionOrBufferedReaderFromZip(JmolAdapter adapter,
InputStream is,
String fileName,
String[] zipDirectory,
Map<String,Object> htParams,
int subFilePtr,
boolean asBufferedReader) |
private static String |
getBinaryStringForBytes(byte[] bytes) |
byte[] |
getCachedPngjBytes(FileManager fm,
String pathName) |
int |
getCrcValue(byte[] bytes) |
private static 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 static String[] |
getSpartanFileList(String name,
String[] dirNums)
returns the list of files to read for every Spartan spardir.
|
(package private) static String |
getStreamAsString(InputStream is) |
(package private) static BufferedInputStream |
getUnGzippedInputStream(byte[] bytes) |
String[] |
getZipDirectoryAndClose(BufferedInputStream bis,
boolean addManifest) |
String |
getZipDirectoryAsStringAndClose(BufferedInputStream bis) |
private String[] |
getZipDirectoryOrErrorAndClose(BufferedInputStream bis,
boolean addManifest) |
Object |
getZipFileContents(BufferedInputStream bis,
String[] list,
int listPtr,
boolean asBufferedInputStream)
iteratively drills into zip files of zip files to extract file content or
zip file directory.
|
byte[] |
getZipFileContentsAsBytes(BufferedInputStream bis,
String[] list,
int listPtr) |
Object |
getZipOutputStream(Object bos) |
private static boolean |
isJmolManifest(String thisEntry) |
InputStream |
newGZIPInputStream(InputStream is) |
javajs.api.ZInputStream |
newZipInputStream(InputStream is) |
private static javajs.api.ZInputStream |
newZIS(InputStream is) |
private static String |
shortSceneFilename(String pathName) |
String[] |
spartanFileList(String name,
String type)
Special loading for file directories.
|
public javajs.api.ZInputStream newZipInputStream(InputStream is)
newZipInputStream in interface JmolZipUtilityprivate static javajs.api.ZInputStream newZIS(InputStream is)
public void getAllZipData(InputStream is, String[] subfileList, String name0, String binaryFileList, Map<String,String> fileData)
getAllZipData in interface JmolZipUtilityis - 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"fileData - private static void getAllZipDataStatic(InputStream is, String[] subfileList, String name0, String binaryFileList, Map<String,String> fileData)
private static String getBinaryStringForBytes(byte[] bytes)
public Object getZipFileContents(BufferedInputStream bis, String[] list, int listPtr, boolean asBufferedInputStream)
getZipFileContents in interface JmolZipUtilitybis - list - listPtr - asBufferedInputStream - for Pmeshpublic byte[] getZipFileContentsAsBytes(BufferedInputStream bis, String[] list, int listPtr)
getZipFileContentsAsBytes in interface JmolZipUtilitypublic String getZipDirectoryAsStringAndClose(BufferedInputStream bis)
getZipDirectoryAsStringAndClose in interface JmolZipUtilitypublic String[] getZipDirectoryAndClose(BufferedInputStream bis, boolean addManifest)
getZipDirectoryAndClose in interface JmolZipUtilityprivate String[] getZipDirectoryOrErrorAndClose(BufferedInputStream bis, boolean addManifest) throws IOException
IOExceptionstatic String getStreamAsString(InputStream is) throws IOException
IOExceptionprivate static boolean isJmolManifest(String thisEntry)
public String cacheZipContents(BufferedInputStream bis, String fileName, Map<String,byte[]> cache)
cacheZipContents in interface JmolZipUtilitybis - fileName - cache - static BufferedInputStream getUnGzippedInputStream(byte[] bytes)
public InputStream newGZIPInputStream(InputStream is) throws IOException
newGZIPInputStream in interface JmolZipUtilityIOExceptionpublic Object getAtomSetCollectionOrBufferedReaderFromZip(JmolAdapter adapter, InputStream is, String fileName, String[] zipDirectory, Map<String,Object> htParams, int subFilePtr, boolean asBufferedReader)
getAtomSetCollectionOrBufferedReaderFromZip in interface JmolZipUtilityprivate static javajs.util.SB checkSpecialData(InputStream is, String[] zipDirectory)
is - zipDirectory - public String[] spartanFileList(String name, String type)
spartanFileList in interface JmolZipUtilityname - type - private static String[] getSpartanDirs(String outputFileData)
outputFileData - private static String[] getSpartanFileList(String name, String[] dirNums)
name - dirNums - static String[] checkSpecialInZip(String[] zipDirectory)
zipDirectory - public byte[] getCachedPngjBytes(FileManager fm, String pathName)
getCachedPngjBytes in interface JmolZipUtilitypublic boolean cachePngjFile(FileManager fm, String[] data)
cachePngjFile in interface JmolZipUtilitypublic void addZipEntry(Object zos, String fileName) throws IOException
addZipEntry in interface JmolZipUtilityIOExceptionpublic void closeZipEntry(Object zos) throws IOException
closeZipEntry in interface JmolZipUtilityIOExceptionpublic Object getZipOutputStream(Object bos)
getZipOutputStream in interface JmolZipUtilitypublic int getCrcValue(byte[] bytes)
getCrcValue in interface JmolZipUtility