public class ZipUnpacker
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private DbControl |
dc |
private java.util.Map<java.lang.String,Directory> |
paths
Cache of directories.
|
Constructor and Description |
---|
ZipUnpacker(DbControl dc)
Create a new zip unpacker.
|
Modifier and Type | Method and Description |
---|---|
private Directory |
getDirectory(Path path)
Get the directory for the specified path.
|
int |
unpackZipFile(Directory rootDir,
java.util.zip.ZipInputStream zip,
File sourceFile,
boolean overwrite,
AbsoluteProgressReporter progress)
Unpack a zip file.
|
private final DbControl dc
private java.util.Map<java.lang.String,Directory> paths
public ZipUnpacker(DbControl dc)
dc
- The DbControl to use for database accesspublic int unpackZipFile(Directory rootDir, java.util.zip.ZipInputStream zip, File sourceFile, boolean overwrite, AbsoluteProgressReporter progress) throws java.io.IOException, BaseException
rootDir
- The directory where the contents of the zip file should be placedzip
- The contents of the zip fileoverwrite
- If existing files should be overwritten or ignoredprogress
- An optional progress reporter for displaying progressjava.io.IOException
- If there is an error when unpacking the zip fileBaseException
- If there is a BASE errorprivate Directory getDirectory(Path path)
path
- The path