Package jetbrains.buildServer.zip
Class AbstractZipReader
- java.lang.Object
-
- jetbrains.buildServer.zip.AbstractZipReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ZipReader
- Direct Known Subclasses:
InMemoryZipFactory.InMemoryArchive
public abstract class AbstractZipReader extends Object implements ZipReader
- Author:
- Leonid Bushuev from JetBrains
-
-
Constructor Summary
Constructors Constructor Description AbstractZipReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Set<String>
allNames()
boolean
doesFileExist(String name)
Checks whether the specified file exists in the archive.boolean
doesFileExist(Pattern namePattern)
Checks whether the file (specified by the given regular expression) exists in the archive.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.BufferedReader
openTextFile(String name, Charset charset)
Opens a text file for read.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.zip.ZipReader
close, getFileSize, openBinaryFile
-
-
-
-
Method Detail
-
listFiles
public List<String> listFiles(Pattern regexPattern)
Description copied from interface:ZipReader
Lists files which names match the given pattern.
-
listDirectoryFiles
public List<String> listDirectoryFiles(String path)
Description copied from interface:ZipReader
Lists 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.txt
We calling this function with "aaa/xxx", it will return:f1.txt ttt/f2.txt
- Specified by:
listDirectoryFiles
in 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.
-
openTextFile
@NotNull public final BufferedReader openTextFile(@NotNull String name, @Nullable Charset charset) throws IOException
Description copied from interface:ZipReader
Opens a text file for read.- Specified by:
openTextFile
in 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:
IOException
FileNotFoundException
- if no entry withname
has been found in the archive.
-
doesFileExist
public boolean doesFileExist(@NotNull String name)
Description copied from interface:ZipReader
Checks whether the specified file exists in the archive.- Specified by:
doesFileExist
in 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:ZipReader
Checks whether the file (specified by the given regular expression) exists in the archive.- Specified by:
doesFileExist
in interfaceZipReader
- Returns:
- file exists.
-
-