Package com._1c.g5.v8.dt.export
Class ZipArchiveBuilder
java.lang.Object
com._1c.g5.v8.dt.export.ZipArchiveBuilder
- All Implemented Interfaces:
IExportArtifactBuilder
,Closeable
,AutoCloseable
An implementation of
IExportArtifactBuilder
that writes data to a zip-file.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Copies a file or directory residing on the local file system into the artifact.static ZipArchiveBuilder
create
(OutputStream outputStream, int level, long maxQueuedDataSize) Creates a new builder.static ZipArchiveBuilder
Creates a new builder.newOutputStream
(Path path) Creates an output stream for writing a file inside the artifact.
-
Method Details
-
create
public static ZipArchiveBuilder create(Path path, int level, long maxQueuedDataSize) throws IOException Creates a new builder.- Parameters:
path
- The path of the target zip-file. May not benull
.level
- The compression level, a number between0
(best speed) and9
(best compression).maxQueuedDataSize
- The maximum queued data size in bytes. Must be greater than0
.- Returns:
- a new zip-file builder. Never
null
. - Throws:
IOException
- if any I/O error occurs.
-
create
public static ZipArchiveBuilder create(OutputStream outputStream, int level, long maxQueuedDataSize) throws IOException Creates a new builder.- Parameters:
outputStream
- The target output stream. May not benull
.level
- The compression level, a number between0
(best speed) and9
(best compression).maxQueuedDataSize
- The maximum queued data size in bytes. Must be greater than0
.- Returns:
- a new zip-file builder. Never
null
. - Throws:
IOException
- if any I/O error occurs.
-
newOutputStream
Description copied from interface:IExportArtifactBuilder
Creates an output stream for writing a file inside the artifact. All nonexistent directories are created automatically. The returned stream does not need wrapping intoBufferedOutputStream
. If the given path already exists, the behavior of this method is not defined.- Specified by:
newOutputStream
in interfaceIExportArtifactBuilder
- Parameters:
path
- The path to the file inside the artifact. May not benull
.- Returns:
- a new output stream. Never
null
. - Throws:
IOException
- if any I/O error occurs.
-
copy
Description copied from interface:IExportArtifactBuilder
Copies a file or directory residing on the local file system into the artifact. All nonexistent directories are created automatically. If the given target path already exists, the behavior of this method is not defined.- Specified by:
copy
in interfaceIExportArtifactBuilder
- Parameters:
sourcePath
- The path of the source file or directory residing on the local file system. May not benull
.targetPath
- The path of the target file or directory inside the artifact. May not benull
.- Throws:
IOException
- if any I/O error occurs.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-