Package org.apache.beam.sdk.util
Class ZipFiles
- java.lang.Object
-
- org.apache.beam.sdk.util.ZipFiles
-
@Internal public final class ZipFiles extends java.lang.Object
Functions for zipping a directory (including a subdirectory) into a ZIP-file or unzipping it again.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
zipDirectory(java.io.File sourceDirectory, java.io.File zipFile)
Zips an entire directory specified by the path.static void
zipDirectory(java.io.File sourceDirectory, java.io.OutputStream outputStream)
Zips an entire directory specified by the path.static void
zipDirectoryOverwrite(java.io.File sourceDirectory, java.io.File zipFile)
Zips an entire directory specified by the path.
-
-
-
Method Detail
-
zipDirectory
public static void zipDirectory(java.io.File sourceDirectory, java.io.File zipFile) throws java.io.IOException
Zips an entire directory specified by the path.- Parameters:
sourceDirectory
- the directory to read from. This directory and all subdirectories will be added to the zip-file. The path within the zip file is relative to the directory given as parameter, not absolute.zipFile
- the zip-file to write to.- Throws:
java.io.IOException
- the zipping failed, e.g. because the input was not readable.java.lang.IllegalArgumentException
- sourceDirectory is not a directory, or zipFile already exists.
-
zipDirectoryOverwrite
public static void zipDirectoryOverwrite(java.io.File sourceDirectory, java.io.File zipFile) throws java.io.IOException
Zips an entire directory specified by the path.- Parameters:
sourceDirectory
- the directory to read from. This directory and all subdirectories will be added to the zip-file. The path within the zip file is relative to the directory given as parameter, not absolute.zipFile
- the zip-file to write to. Will be overwritten if it already exists.- Throws:
java.io.IOException
- the zipping failed, e.g. because the input was not readable.java.lang.IllegalArgumentException
- sourceDirectory is not a directory.
-
zipDirectory
public static void zipDirectory(java.io.File sourceDirectory, java.io.OutputStream outputStream) throws java.io.IOException
Zips an entire directory specified by the path.- Parameters:
sourceDirectory
- the directory to read from. This directory and all subdirectories will be added to the zip-file. The path within the zip file is relative to the directory given as parameter, not absolute.outputStream
- the stream to write the zip-file to. This method does not close outputStream.- Throws:
java.io.IOException
- the zipping failed, e.g. because the input was not readable.
-
-