Class InMemoryZipFactory.InMemoryArchive
- java.lang.Object
-
- jetbrains.buildServer.zip.AbstractZipReader
-
- jetbrains.buildServer.serverSide.util.InMemoryZipFactory.InMemoryArchive
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ZipReader,ZipWriter
- Enclosing class:
- InMemoryZipFactory
public static final class InMemoryZipFactory.InMemoryArchive extends AbstractZipReader implements ZipWriter, ZipReader
-
-
Constructor Summary
Constructors Constructor Description InMemoryArchive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<String>allNames()voidclose()Closes the opened zip file.OutputStreamcreateBinaryFile(String name)Creates a binary output stream to write into an archive.OutputStreamcreateBinaryFile(String name, long mtimeMillis)Creates a new ZIP entry to store binary data and returns anOutputStreamto it.WritercreateTextFile(String name, Charset charset)Creates a text output stream to write into an archive.WritercreateTextFile(String name, Charset charset, long mtimeMillis)Creates a new ZIP entry to store plain text data and returns aWriterto it.Collection<String>getAllFileNames()longgetFileSize(String name)Returns the size of the (uncompressed) file.InputStreamopenBinaryFile(String name)Opens a binary file for read.voidsetArchiveComment(String comment)Writes a comment to the archive.-
Methods inherited from class jetbrains.buildServer.zip.AbstractZipReader
doesFileExist, doesFileExist, listDirectoryFiles, listFiles, openTextFile
-
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
doesFileExist, doesFileExist, listDirectoryFiles, listFiles, openTextFile
-
-
-
-
Method Detail
-
setArchiveComment
public void setArchiveComment(@Nullable String comment)Description copied from interface:ZipWriterWrites a comment to the archive.- Specified by:
setArchiveCommentin interfaceZipWriter- Parameters:
comment- the text to write as a comment.
-
createTextFile
@NotNull public Writer createTextFile(@NotNull String name, @Nullable Charset charset)
Creates a text output stream to write into an archive. The character code table depends on the implementation.- Specified by:
createTextFilein interfaceZipWriter- Parameters:
name- file name (relative to the archive root).charset- character set to use for this file, or null for use default character set.- Returns:
- text output stream.
- See Also:
ZipWriter.createTextFile(String, Charset)
-
createTextFile
@NotNull public Writer createTextFile(@NotNull String name, @Nullable Charset charset, long mtimeMillis)
Creates a new ZIP entry to store plain text data and returns a
Writerto it. It's the client's responsibility to close the returnedWriter.- Specified by:
createTextFilein interfaceZipWriter- Parameters:
name- the name of the ZIP entry to create (relative path with forward slashes (/)).charset- the optional character set to use, ornullif the default character set is to be used.mtimeMillis- the entry's modification time (@{code mtime}), in milliseconds since epoch.- Returns:
- the
Writerpointing to the newly created ZIP entry. TheWriteris already buffered, to there's no need to wrap it into aBufferedWriter. - See Also:
ZipWriter.createTextFile(String, Charset, long)
-
createBinaryFile
@NotNull public OutputStream createBinaryFile(@NotNull String name)
Creates a binary output stream to write into an archive.- Specified by:
createBinaryFilein interfaceZipWriter- Parameters:
name- file name (relative to the archive root).- Returns:
- binary output stream.
- See Also:
ZipWriter.createBinaryFile(String)
-
createBinaryFile
@NotNull public OutputStream createBinaryFile(@NotNull String name, long mtimeMillis)
Creates a new ZIP entry to store binary data and returns an
OutputStreamto it. It's the client's responsibility to close the returnedOutputStream.- Specified by:
createBinaryFilein interfaceZipWriter- Parameters:
name- the name of the ZIP entry to create (relative path with forward slashes (/)).mtimeMillis- the entry's modification time (@{code mtime}), in milliseconds since epoch.- Returns:
- the
OutputStreampointing to the newly created ZIP entry. TheOutputStreamis already buffered, to there's no need to wrap it into aBufferedOutputStream. - See Also:
ZipWriter.createBinaryFile(String, long)
-
close
public void close()
Description copied from interface:ZipReaderCloses the opened zip file.
-
allNames
protected Set<String> allNames()
- Specified by:
allNamesin classAbstractZipReader
-
getAllFileNames
@NotNull public Collection<String> getAllFileNames()
-
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.
-
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.
-
-