Package jetbrains.buildServer.util
Class ZipWriterDecorator
- java.lang.Object
-
- jetbrains.buildServer.util.ZipWriterDecorator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ZipWriter
public class ZipWriterDecorator extends Object implements ZipWriter
Created by Nikita.Skvortsov date: 14.08.2014.
-
-
Constructor Summary
Constructors Constructor Description ZipWriterDecorator(ZipWriter delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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.voidsetArchiveComment(String comment)Writes a comment to the archive.
-
-
-
Constructor Detail
-
ZipWriterDecorator
public ZipWriterDecorator(@NotNull ZipWriter delegate)
-
-
Method Detail
-
setArchiveComment
public final void setArchiveComment(@Nullable String comment) throws IOExceptionDescription copied from interface:ZipWriterWrites a comment to the archive.- Specified by:
setArchiveCommentin interfaceZipWriter- Parameters:
comment- the text to write as a comment.- Throws:
IOException- fail.
-
createTextFile
@NotNull public Writer createTextFile(@NotNull String name, @Nullable Charset charset) throws IOException
Description copied from interface:ZipWriterCreates 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.
- Throws:
IOException- See Also:
ZipWriter.createTextFile(String, Charset, long)
-
createTextFile
@NotNull public Writer createTextFile(@NotNull String name, @Nullable Charset charset, long mtimeMillis) throws IOException
Description copied from interface:ZipWriterCreates 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. - Throws:
ZipException- if a ZIP stream error occurs.IOException- if any other I/O error occurs.- See Also:
ZipWriter.createTextFile(String, Charset)
-
createBinaryFile
@NotNull public OutputStream createBinaryFile(@NotNull String name) throws IOException
Description copied from interface:ZipWriterCreates 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.
- Throws:
IOException- See Also:
ZipWriter.createBinaryFile(String, long)
-
createBinaryFile
@NotNull public OutputStream createBinaryFile(@NotNull String name, long mtimeMillis) throws IOException
Description copied from interface:ZipWriterCreates 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. - Throws:
ZipException- if a ZIP stream error occurs.IOException- if any other I/O error occurs.- See Also:
ZipWriter.createBinaryFile(String)
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-