cytoscape.util
Class ZipUtil
java.lang.Object
cytoscape.util.ZipUtil
- public class ZipUtil
- extends Object
Compression-related methods mainly for Session Writer.
The created zip files can be decompressed by any zip utilities.
- Since:
- Cytoscape 2.3
- Version:
- 0.9
- Author:
- kono
- See Also:
cytoscape.data.writers.CytoscapeSessionWriter
Method Summary |
void |
compressFast(int compressionLevel,
boolean cleanFlag)
Faster version of compression method. |
static InputStream |
readFile(String zipName,
String fileNameRegEx)
Reads a file contained within a zip file and returns an InputStream. |
DEF_COMPRESSION_LEVEL
public static final int DEF_COMPRESSION_LEVEL
- See Also:
- Constant Field Values
ZipUtil
public ZipUtil(String zipFile,
String[] fileList,
String sessionDir)
- Constructor.
- Parameters:
zipFile
- Output zip file name.fileList
- List of file names to be compressed.sessionDir
- Root dir created in the zip archive.
compressFast
public void compressFast(int compressionLevel,
boolean cleanFlag)
throws IOException
- Faster version of compression method.
- Parameters:
compressionLevel
- Level of compression. Range = 0-9.
0 is no-compression, and 9 is most space-efficeint.
However, 9 is slow.cleanFlag
- If true, remove all imput files.
- Throws:
IOException
readFile
public static InputStream readFile(String zipName,
String fileNameRegEx)
throws IOException
- Reads a file contained within a zip file and returns an InputStream.
- Parameters:
zipName
- The name of the zip file to read.fileNameRegEx
- A regular expression that identifies the file to be read. In
general this should just be the file name you're looking for.
If more than one file matches the regular expression, only the
first will be returned. If you're looking for a specific file
remeber to build your regular expression correctly. For
example, if you're looking for the file 'vizmap.props', make
your regular expression '.*vizmap.props' to accomodate any
clutter from the zip file.
- Returns:
- An InputStream of the zip entry identified by the regular
expression or null if nothing matches.
- Throws:
IOException