Package jetbrains.buildServer.zip
Interface ZipFactory
-
- All Known Implementing Classes:
BigFileZipFactory
,DiskBasedCenZipFactory
,FakeZipFactory
,FileZipFactory
,InMemoryZipFactory
,MemoryConservativeZipFactory
,ZipFactoryDecorator
public interface ZipFactory
A simple factory forZipWriter
and ZipReader.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ZipWriter
createZipArchive(String name)
Creates a zip archive.boolean
isFileExist(String name)
Checks whether the file exists.ZipReader
openZipArchive(String name)
Opens an existent zip archive to read.void
rename(String sourceName, String targetName)
Renames or moves the file.void
setLevel(int level)
Sets the compression level for entries which areZipEntry.DEFLATED
.
-
-
-
Method Detail
-
createZipArchive
@NotNull ZipWriter createZipArchive(@NotNull String name) throws IOException, IllegalStateException
Creates a zip archive.- Parameters:
name
- path and name of a zip file to create.- Returns:
- zip writer.
- Throws:
IOException
IllegalStateException
-
openZipArchive
ZipReader openZipArchive(String name) throws IOException, IllegalStateException
Opens an existent zip archive to read.- Parameters:
name
- path and name of a zip file to create.- Returns:
- zip reader.
- Throws:
IOException
IllegalStateException
-
isFileExist
boolean isFileExist(String name)
Checks whether the file exists.- Parameters:
name
- file path and name.- Returns:
- exists.
- Since:
- 9.0
-
rename
void rename(String sourceName, String targetName) throws IOException
Renames or moves the file.- Parameters:
sourceName
- an existent file path and name to rename.targetName
- new path and name.- Throws:
IOException
- when couldn't rename.- Since:
- 9.0
-
setLevel
void setLevel(int level)
Sets the compression level for entries which are
ZipEntry.DEFLATED
. The default setting isDeflater.DEFAULT_COMPRESSION
.This method only affects
createZipArchive(String)
behaviour.- Parameters:
level
- the compression level (0-9).- Throws:
IllegalArgumentException
- if the compression level is invalid.IllegalStateException
- if this is a shared ZIP factory.- Since:
- 2017.2.4, 2018.1
- See Also:
Deflater.setLevel(int)
,ZipOutputStream.setLevel(int)
-
-