org.jmol.util
Class ZipUtil
java.lang.Object
org.jmol.util.ZipUtil
public class ZipUtil
- extends java.lang.Object
Method Summary |
static void |
getAllData(java.io.InputStream is,
java.lang.String[] subfileList,
java.lang.String name0,
java.lang.String binaryFileList,
java.util.Map<java.lang.String,java.lang.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. |
static java.lang.String |
getBinaryStringForBytes(byte[] bytes)
|
static java.lang.String |
getGzippedBytesAsString(byte[] bytes)
|
static java.io.InputStream |
getGzippedInputStream(byte[] bytes)
|
static java.util.zip.ZipInputStream |
getStream(java.io.InputStream is)
|
static java.lang.String[] |
getZipDirectoryAndClose(java.io.InputStream is,
boolean addManifest)
|
static java.lang.String |
getZipDirectoryAsStringAndClose(java.io.InputStream is)
|
private static java.lang.String[] |
getZipDirectoryOrErrorAndClose(java.io.InputStream is,
boolean addManifest)
|
static byte[] |
getZipEntryAsBytes(java.util.zip.ZipInputStream zis)
|
static java.lang.String |
getZipEntryAsString(java.io.InputStream is)
|
static java.lang.Object |
getZipFileContents(java.io.InputStream is,
java.lang.String[] list,
int listPtr,
boolean asBufferedInputStream)
iteratively drills into zip files of zip files to extract file content
or zip file directory. |
static byte[] |
getZipFileContentsAsBytes(java.io.InputStream is,
java.lang.String[] list,
int listPtr)
|
static boolean |
isGzip(byte[] bytes)
|
static boolean |
isGzip(java.io.InputStream is)
|
static boolean |
isJmolManifest(java.lang.String thisEntry)
|
static boolean |
isZipFile(byte[] bytes)
|
static boolean |
isZipFile(java.io.InputStream is)
|
static boolean |
isZipFile(java.lang.String filePath)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZipUtil
public ZipUtil()
isZipFile
public static boolean isZipFile(java.lang.String filePath)
isZipFile
public static boolean isZipFile(java.io.InputStream is)
throws java.lang.Exception
- Throws:
java.lang.Exception
isZipFile
public static boolean isZipFile(byte[] bytes)
throws java.lang.Exception
- Throws:
java.lang.Exception
getStream
public static java.util.zip.ZipInputStream getStream(java.io.InputStream is)
getAllData
public static void getAllData(java.io.InputStream is,
java.lang.String[] subfileList,
java.lang.String name0,
java.lang.String binaryFileList,
java.util.Map<java.lang.String,java.lang.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"fileData
-
getBinaryStringForBytes
public static java.lang.String getBinaryStringForBytes(byte[] bytes)
getZipFileContents
public static java.lang.Object getZipFileContents(java.io.InputStream is,
java.lang.String[] list,
int listPtr,
boolean asBufferedInputStream)
- iteratively drills into zip files of zip files to extract file content
or zip file directory. Also works with JAR files.
Does not return "__MACOS" paths
- Parameters:
is
- list
- listPtr
- asBufferedInputStream
- for Pmesh
- Returns:
- directory listing or subfile contents
getZipFileContentsAsBytes
public static byte[] getZipFileContentsAsBytes(java.io.InputStream is,
java.lang.String[] list,
int listPtr)
getZipDirectoryAsStringAndClose
public static java.lang.String getZipDirectoryAsStringAndClose(java.io.InputStream is)
getZipDirectoryAndClose
public static java.lang.String[] getZipDirectoryAndClose(java.io.InputStream is,
boolean addManifest)
isJmolManifest
public static boolean isJmolManifest(java.lang.String thisEntry)
getZipDirectoryOrErrorAndClose
private static java.lang.String[] getZipDirectoryOrErrorAndClose(java.io.InputStream is,
boolean addManifest)
throws java.io.IOException
- Throws:
java.io.IOException
getZipEntryAsString
public static java.lang.String getZipEntryAsString(java.io.InputStream is)
throws java.io.IOException
- Throws:
java.io.IOException
getZipEntryAsBytes
public static byte[] getZipEntryAsBytes(java.util.zip.ZipInputStream zis)
throws java.io.IOException
- Throws:
java.io.IOException
isGzip
public static boolean isGzip(byte[] bytes)
isGzip
public static boolean isGzip(java.io.InputStream is)
throws java.lang.Exception
- Throws:
java.lang.Exception
getGzippedBytesAsString
public static java.lang.String getGzippedBytesAsString(byte[] bytes)
getGzippedInputStream
public static java.io.InputStream getGzippedInputStream(byte[] bytes)