Package jetbrains.buildServer.zip
Class ZipExtractor
- java.lang.Object
-
- jetbrains.buildServer.zip.ZipExtractor
-
public class ZipExtractor extends Object
-
-
Constructor Summary
Constructors Constructor Description ZipExtractor(ZipReader zipReader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
extractDirectory(String zipPath, File targetDirectory)
Extract directory content from the ZIP archive.void
extractFile(String zipPath, File targetFile)
Extract file from the ZIP archivevoid
extractFile(String zipPath, File targetFile, TCStreamUtil.ProgressIncrementListener progressListener)
-
-
-
Constructor Detail
-
ZipExtractor
public ZipExtractor(ZipReader zipReader)
-
-
Method Detail
-
extractDirectory
public void extractDirectory(@NotNull String zipPath, @NotNull File targetDirectory) throws IOException
Extract directory content from the ZIP archive. For example, if the archive containsa/b/c/1.txt a/b/c/2.txt 3.txt
andzipPath = "a/b/c" targetDirectory = "/tmp"
then"/tmp/1.txt"
and"/tmp/2.txt"
will be created. IfzipPath
is empty then all files will be extracted. Files intargetDirectory
with the name equal to the extracted file name will be overwritten, with the different name will not be modified. AlsotargetDirectory
will be created if not exist.- Throws:
IOException
-
extractFile
public void extractFile(@NotNull String zipPath, @NotNull File targetFile) throws IOException
Extract file from the ZIP archive For example, ifzipPath = "a/b/c.txt"
thentargetFile with content of the "a/b/c.txt" will be created.
IftargetFile
doesn't exist, it will be created. Otherwise it will be overwritten.- Throws:
FileNotFoundException
- if no entry with namedzipPath
has been found in the archive.IOException
- if any other I/O error occurs.- See Also:
extractFile(String, File, TCStreamUtil.ProgressIncrementListener)
-
extractFile
public void extractFile(@NotNull String zipPath, @NotNull File targetFile, @Nullable TCStreamUtil.ProgressIncrementListener progressListener) throws IOException
- Throws:
FileNotFoundException
- if no entry with namedzipPath
has been found in the archive.IOException
- if any other I/O error occurs.- See Also:
extractFile(String, File)
-
-