|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.util.zip.ZipFiles
public final class ZipFiles
This is a utility class for working with Zip files.
Method Summary | |
---|---|
static void |
unzip(EFile f,
DirectoryView dv,
Filter<? super EntityView> ef)
Extract the entities that pass the filter from the supplied Zip or Jar file into the directory. |
static void |
unzip(ReadableFile f,
DirectoryView dv)
Unzip the supplied Zip or Jar file into the directory. |
static void |
unzip(ReadableFile f,
DirectoryView dv,
boolean overwrite)
Unzip the supplied Zip or Jar file into the directory. |
static void |
unzip(ReadableFile f,
DirectoryView dv,
OverwriteStrategy overwriteStrategy)
|
static EFile |
zip(DirectoryView root,
AbsoluteLocation zipRoot,
DirectoryView target,
String name)
Create a new Zip file and put all its contents under the supplied absolute location in the Zip file. |
static EFile |
zip(DirectoryView root,
DirectoryView target,
String name)
Create a new Zip file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void unzip(ReadableFile f, DirectoryView dv, OverwriteStrategy overwriteStrategy) throws EntityFoundException, DirectoryNotEmptyException
EntityFoundException
DirectoryNotEmptyException
public static void unzip(ReadableFile f, DirectoryView dv, boolean overwrite) throws EntityFoundException, DirectoryNotEmptyException
If overwrite
is set to true
, existing entities in the
target directory will be overwritten with files from the Zip file if
their names are the same. If the existing entity is a directory with some
contents, it will be preserved and an DirectoryNotEmptyException
is thrown instead.
f
- The Zip file.dv
- The target directory.overwrite
- Should a file in the target directory with the same name
as a file from the Zip archive be overwritten? A value of true
means that the DoOverwriteAndLogWarning
overwrite strategy is
used, a value of false
gives the
DontOverwriteAndThrowException
strategy.
EntityFoundException
- If a file that this method tries to create
already exists and overwrite
is set to false
. When the
exception is thrown, the target directory will contain the contents of
the Zip file that was unzipped so far.
DirectoryNotEmptyException
- If a file from the Zip archive has the
same name as a non-empty directory in the target directory.unzip(EFile, DirectoryView, Filter)
,
unzip(ReadableFile, DirectoryView, boolean)
public static void unzip(ReadableFile f, DirectoryView dv) throws EntityFoundException
f
- The Zip file.dv
- The target directory.
EntityFoundException
- If a file that this method tries to create
already exists. When the exception is thrown, the target directory will
contain the contents of the Zip file that was unzipped so far.unzip(EFile, DirectoryView, Filter)
,
unzip(ReadableFile, DirectoryView, boolean)
public static void unzip(EFile f, DirectoryView dv, Filter<? super EntityView> ef) throws EntityFoundException
f
- The Zip file. This must be in a java.io.File
backed file
system.dv
- The target directory.ef
- The filter that the entities to extract must pass.
EntityFoundException
- If a file that this method tries to create
already exists. When the exception is thrown, the target directory will
contain the contents of the Zip file that was unzipped so far.unzip(ReadableFile, DirectoryView)
public static EFile zip(DirectoryView root, DirectoryView target, String name) throws EntityFoundException
root
directory is
added to the root directory of the Zip file.
This method uses the ZipCreator
class. For more control over the
Zip file contents, use the Zip builder from the At4J project instead.
root
- The directory whose contents should be added to the Zip file.
The directory itself is not added.target
- The target directory where the Zip file will be created.name
- The name of the created Zip file.
EntityFoundException
- If the target file already exists.zip(DirectoryView, AbsoluteLocation, DirectoryView, String)
public static EFile zip(DirectoryView root, AbsoluteLocation zipRoot, DirectoryView target, String name) throws EntityFoundException
This method uses the ZipCreator
class. For more control over the
Zip file contents, use the Zip builder from the At4J project instead.
root
- The directory whose contents should be added to the Zip file.
The directory itself is not added.zipRoot
- The absolute location under which contents are added to
the Zip file.target
- The target directory where the Zip file will be created.name
- The name of the created Zip file.
EntityFoundException
- If the target file already exists.zip(DirectoryView, DirectoryView, String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |