# Class ZipTools

java.lang.Object
javajs.util.ZipTools

All Implemented Interfaces:
  `GenericZipTools`

public class ZipTools extends Object implements GenericZipTools
Note the JSmol/HTML5 must use its own version of java.util.zip.ZipOutputStream.

## Constructor Summary

Constructors
Constructor
Description
`ZipTools()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addZipEntry(Object zos, String fileName)`
`String`
`cacheZipContents(BufferedInputStream bis, String fileName, Map<String,Object> cache, boolean asByteArray)`
`void`
`closeZipEntry(Object zos)`
`void`
`getAllZipData(InputStream is, String[] subfileList, String name0, String binaryFileList, String exclude, Map<String,String> fileData)`
Deprecated.
`int`
`getCrcValue(byte[] bytes)`
`static String`
`getStreamAsString(InputStream is)`
`BufferedInputStream`
`getUnGzippedInputStream(byte[] bytes)`
`String[]`
`getZipDirectoryAndClose(BufferedInputStream bis, String manifestID)`
`String`
`getZipDirectoryAsStringAndClose(BufferedInputStream bis)`
`byte[]`
`getZipFileContentsAsBytes(BufferedInputStream bis, String[] list, int listPtr)`
`Object`
`getZipFileDirectory(BufferedInputStream bis, String[] list, int listPtr, boolean asBufferedInputStream)`
iteratively drills into zip files of zip files to extract file content or zip file directory.
`Object`
`getZipOutputStream(Object bos)`
`boolean`
`isZipStream(Object br)`
`InputStream`
`newBZip2InputStream(InputStream is)`
`InputStream`
`newGZIPInputStream(InputStream is)`
`ZInputStream`
`newZipInputStream(InputStream is)`
`void`
`readFileAsMap(BufferedInputStream bis, Map<String,Object> bdata, String name)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ZipTools

public ZipTools()

## Method Details

### newZipInputStream

public ZInputStream newZipInputStream(InputStream is)

Specified by:
  `newZipInputStream` in interface `GenericZipTools`

### getAllZipData

@Deprecated public void getAllZipData(InputStream is, String[] subfileList, String name0, String binaryFileList, String exclude, Map<String,String> fileData)
Deprecated.

Specified by:
  `getAllZipData` in interface `GenericZipTools`

### getZipFileDirectory

public Object getZipFileDirectory(BufferedInputStream bis, 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

Specified by:
  `getZipFileDirectory` in interface `GenericZipTools`
Parameters:
  `bis` -
  `list` -
  `listPtr` -
  `asBufferedInputStream` - for Pmesh
Returns:
  directory listing or subfile contents

### getZipFileContentsAsBytes

public byte[] getZipFileContentsAsBytes(BufferedInputStream bis, String[] list, int listPtr)

Specified by:
  `getZipFileContentsAsBytes` in interface `GenericZipTools`

### getZipDirectoryAsStringAndClose

public String getZipDirectoryAsStringAndClose(BufferedInputStream bis)

Specified by:
  `getZipDirectoryAsStringAndClose` in interface `GenericZipTools`

### getZipDirectoryAndClose

public String[] getZipDirectoryAndClose(BufferedInputStream bis, String manifestID)

Specified by:
  `getZipDirectoryAndClose` in interface `GenericZipTools`

### getStreamAsString

public static String getStreamAsString(InputStream is) throws IOException

Throws:
  `IOException`

### newGZIPInputStream

public InputStream newGZIPInputStream(InputStream is) throws IOException

Specified by:
  `newGZIPInputStream` in interface `GenericZipTools`
Throws:
  `IOException`

### newBZip2InputStream

public InputStream newBZip2InputStream(InputStream is) throws IOException

Specified by:
  `newBZip2InputStream` in interface `GenericZipTools`
Throws:
  `IOException`

### getUnGzippedInputStream

public BufferedInputStream getUnGzippedInputStream(byte[] bytes)

Specified by:
  `getUnGzippedInputStream` in interface `GenericZipTools`

### addZipEntry

public void addZipEntry(Object zos, String fileName) throws IOException

Specified by:
  `addZipEntry` in interface `GenericZipTools`
Throws:
  `IOException`

### closeZipEntry

public void closeZipEntry(Object zos) throws IOException

Specified by:
  `closeZipEntry` in interface `GenericZipTools`
Throws:
  `IOException`

### getZipOutputStream

public Object getZipOutputStream(Object bos)

Specified by:
  `getZipOutputStream` in interface `GenericZipTools`

### getCrcValue

public int getCrcValue(byte[] bytes)

Specified by:
  `getCrcValue` in interface `GenericZipTools`

### readFileAsMap

public void readFileAsMap(BufferedInputStream bis, Map<String,Object> bdata, String name)

Specified by:
  `readFileAsMap` in interface `GenericZipTools`

### cacheZipContents

public String cacheZipContents(BufferedInputStream bis, String fileName, Map<String,Object> cache, boolean asByteArray)

Specified by:
  `cacheZipContents` in interface `GenericZipTools`

### isZipStream

public boolean isZipStream(Object br)

Specified by:
  `isZipStream` in interface `GenericZipTools`