Package jetbrains.buildServer.zip
Interface ZipWriter
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractZipWriter
,InMemoryZipFactory.InMemoryArchive
,ZipWriterDecorator
public interface ZipWriter extends Closeable
Common archive-file writer.Usage: take a stream from
createTextFile(java.lang.String, java.nio.charset.Charset)
orcreateBinaryFile(java.lang.String)
, use this stream and then flush/close it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OutputStream
createBinaryFile(String name)
Creates a binary output stream to write into an archive.OutputStream
createBinaryFile(String name, long mtimeMillis)
Creates a new ZIP entry to store binary data and returns anOutputStream
to it.Writer
createTextFile(String name, Charset charset)
Creates a text output stream to write into an archive.Writer
createTextFile(String name, Charset charset, long mtimeMillis)
Creates a new ZIP entry to store plain text data and returns aWriter
to it.void
setArchiveComment(String comment)
Writes a comment to the archive.
-
-
-
Method Detail
-
setArchiveComment
void setArchiveComment(@Nullable String comment) throws IOException, IllegalStateException
Writes a comment to the archive.- Parameters:
comment
- the text to write as a comment.- Throws:
IOException
- fail.IllegalStateException
- when the implementation doesn't support archive comments.
-
createTextFile
@NotNull Writer createTextFile(@NotNull String name, @Nullable Charset charset) throws IOException, IllegalStateException
Creates a text output stream to write into an archive. The character code table depends on the implementation.- 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
IllegalStateException
- See Also:
createTextFile(String, Charset, long)
-
createTextFile
@NotNull Writer createTextFile(@NotNull String name, @Nullable Charset charset, long mtimeMillis) throws IOException
Creates a new ZIP entry to store plain text data and returns a
Writer
to it. It's the client's responsibility to close the returnedWriter
.- Parameters:
name
- the name of the ZIP entry to create (relative path with forward slashes (/
)).charset
- the optional character set to use, ornull
if the default character set is to be used.mtimeMillis
- the entry's modification time (@{code mtime}), in milliseconds since epoch.- Returns:
- the
Writer
pointing to the newly created ZIP entry. TheWriter
is 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.- Since:
- 2017.2.4, 2018.1
- See Also:
createTextFile(String, Charset)
-
createBinaryFile
@NotNull OutputStream createBinaryFile(@NotNull String name) throws IOException, IllegalStateException
Creates a binary output stream to write into an archive.- Parameters:
name
- file name (relative to the archive root).- Returns:
- binary output stream.
- Throws:
IOException
IllegalStateException
- See Also:
createBinaryFile(String, long)
-
createBinaryFile
@NotNull OutputStream createBinaryFile(@NotNull String name, long mtimeMillis) throws IOException
Creates a new ZIP entry to store binary data and returns an
OutputStream
to it. It's the client's responsibility to close the returnedOutputStream
.- 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
OutputStream
pointing to the newly created ZIP entry. TheOutputStream
is 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.- Since:
- 2017.2.4, 2018.1
- See Also:
createBinaryFile(String)
-
-