Package jetbrains.buildServer.zip
Class AbstractZipWriter
- java.lang.Object
-
- jetbrains.buildServer.zip.AbstractZipWriter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ZipWriter
public abstract class AbstractZipWriter extends Object implements ZipWriter
Abstract
ZipWriter
which adds a sane implementation ofcreateTextFile(String, Charset, long)
.- Since:
- 2017.2.4, 2018.1
- Author:
- Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractZipWriter()
Empty constructor to be used by descendants.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputStream
createBinaryFile(String name)
Creates a binary output stream to write into an archive.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.-
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.ZipWriter
createBinaryFile, setArchiveComment
-
-
-
-
Method Detail
-
createTextFile
@NotNull public final Writer createTextFile(@NotNull String name, @Nullable Charset charset) throws IOException
Creates a text output stream to write into an archive. The character code table depends on the implementation.- Specified by:
createTextFile
in 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)
-
createTextFile
@NotNull public 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
.- Specified by:
createTextFile
in interfaceZipWriter
- 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.- See Also:
ZipWriter.createTextFile(String, Charset, long)
-
createBinaryFile
@NotNull public final OutputStream createBinaryFile(@NotNull String name) throws IOException
Creates a binary output stream to write into an archive.- Specified by:
createBinaryFile
in interfaceZipWriter
- Parameters:
name
- file name (relative to the archive root).- Returns:
- binary output stream.
- Throws:
IOException
- See Also:
ZipWriter.createBinaryFile(String)
-
-