Package jetbrains.buildServer.util
Class ZipReaderDecorator
- java.lang.Object
-
- jetbrains.buildServer.util.ZipReaderDecorator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ZipReader
public class ZipReaderDecorator extends Object implements ZipReader
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedZipReaderDecorator(ZipReader target)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the opened zip file.booleandoesFileExist(String name)Checks whether the specified file exists in the archive.booleandoesFileExist(Pattern namePattern)Checks whether the file (specified by the given regular expression) exists in the archive.longgetFileSize(String name)Returns the size of the (uncompressed) file.List<String>listDirectoryFiles(String path)Lists files that are in the specified directory.List<String>listFiles(Pattern regexPattern)Lists files which names match the given pattern.InputStreamopenBinaryFile(String name)Opens a binary file for read.BufferedReaderopenTextFile(String name, Charset charset)Opens a text file for read.
-
-
-
Constructor Detail
-
ZipReaderDecorator
protected ZipReaderDecorator(@NotNull ZipReader target)
-
-
Method Detail
-
listFiles
public List<String> listFiles(Pattern regexPattern)
Description copied from interface:ZipReaderLists files which names match the given pattern.
-
listDirectoryFiles
public List<String> listDirectoryFiles(String path)
Description copied from interface:ZipReaderLists files that are in the specified directory.For example, if the archive contains following files:
aaa/xxx/f1.txt aaa/xxx/ttt/f2.txt aaa/yyy/f3.txtWe calling this function with "aaa/xxx", it will return:f1.txt ttt/f2.txt- Specified by:
listDirectoryFilesin interfaceZipReader- Parameters:
path- directory path.- Returns:
- list of file names related to the give path, ordered as the related files are placed in the archive file.
-
getFileSize
public long getFileSize(String name)
Description copied from interface:ZipReaderReturns the size of the (uncompressed) file.- Specified by:
getFileSizein interfaceZipReader- Parameters:
name- file name.- Returns:
- size of file, in bytes; or
Long.MIN_VALUEif file doesn't exist.
-
openTextFile
@NotNull public BufferedReader openTextFile(@NotNull String name, @Nullable Charset charset) throws IOException
Description copied from interface:ZipReaderOpens a text file for read.- Specified by:
openTextFilein interfaceZipReader- Parameters:
name- name of the file to open.charset- desired character set, or null for using the default character set.- Returns:
- text input stream.
- Throws:
IOExceptionFileNotFoundException- if no entry withnamehas been found in the archive.
-
openBinaryFile
@NotNull public InputStream openBinaryFile(@NotNull String name) throws IOException
Description copied from interface:ZipReaderOpens a binary file for read.- Specified by:
openBinaryFilein interfaceZipReader- Parameters:
name- name of the file to open.- Returns:
- binary input stream.
- Throws:
IOExceptionFileNotFoundException- if no entry withnamehas been found in the archive.
-
doesFileExist
public boolean doesFileExist(@NotNull String name)Description copied from interface:ZipReaderChecks whether the specified file exists in the archive.- Specified by:
doesFileExistin interfaceZipReader- Parameters:
name- name of the file to check for existence.- Returns:
- file exists.
-
doesFileExist
public boolean doesFileExist(@NotNull Pattern namePattern)Description copied from interface:ZipReaderChecks whether the file (specified by the given regular expression) exists in the archive.- Specified by:
doesFileExistin interfaceZipReader- Returns:
- file exists.
-
-