Class InMemoryZipFactory
- java.lang.Object
-
- jetbrains.buildServer.serverSide.util.InMemoryZipFactory
-
- All Implemented Interfaces:
ZipFactory
public final class InMemoryZipFactory extends Object implements ZipFactory
Simple, not thread-safe, in-memory implementation ofZipFactoryNOTE: it's not suitable for tests working with big data sets, useFakeZipFactoryinstead
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInMemoryZipFactory.InMemoryArchive
-
Constructor Summary
Constructors Constructor Description InMemoryZipFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InMemoryZipFactory.InMemoryArchivecreateZipArchive(String name)Creates a zip archive.Collection<InMemoryZipFactory.InMemoryArchive>getArchives()booleanisFileExist(String name)Checks whether the file exists.InMemoryZipFactory.InMemoryArchiveopenZipArchive(String name)Opens an existent zip archive to read.voidrename(String sourceName, String targetName)Renames or moves the file.voidsetLevel(int level)Sets the compression level for entries which areZipEntry.DEFLATED.
-
-
-
Method Detail
-
createZipArchive
@NotNull public InMemoryZipFactory.InMemoryArchive createZipArchive(@NotNull String name)
Description copied from interface:ZipFactoryCreates a zip archive.- Specified by:
createZipArchivein interfaceZipFactory- Parameters:
name- path and name of a zip file to create.- Returns:
- zip writer.
-
openZipArchive
public InMemoryZipFactory.InMemoryArchive openZipArchive(String name)
Description copied from interface:ZipFactoryOpens an existent zip archive to read.- Specified by:
openZipArchivein interfaceZipFactory- Parameters:
name- path and name of a zip file to create.- Returns:
- zip reader.
-
isFileExist
public boolean isFileExist(String name)
Description copied from interface:ZipFactoryChecks whether the file exists.- Specified by:
isFileExistin interfaceZipFactory- Parameters:
name- file path and name.- Returns:
- exists.
-
getArchives
@NotNull public Collection<InMemoryZipFactory.InMemoryArchive> getArchives()
-
rename
public void rename(String sourceName, String targetName) throws IOException
Description copied from interface:ZipFactoryRenames or moves the file.- Specified by:
renamein interfaceZipFactory- Parameters:
sourceName- an existent file path and name to rename.targetName- new path and name.- Throws:
IOException- when couldn't rename.
-
setLevel
public void setLevel(int level)
Sets the compression level for entries which are
ZipEntry.DEFLATED. The default setting isDeflater.DEFAULT_COMPRESSION.This method only affects
ZipFactory.createZipArchive(String)behaviour.- Specified by:
setLevelin interfaceZipFactory- Parameters:
level- the compression level (0-9).- See Also:
ZipFactory.setLevel(int)
-
-