Class ZipFileOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.BufferedOutputStream
org.refcodes.io.ZipFileOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Represents an
OutputStream to a provided File: In case the
file points to a ZIP compressed file, then a therein to be contained file
with the same name excluding the ".zip" extension is created by the
OutputStream.-
Field Summary
Fields inherited from class java.io.BufferedOutputStream
buf, countFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionZipFileOutputStream(File aFile) Instantiates a new zip file output stream impl.ZipFileOutputStream(File parent, String child) Instantiates a new zip file output stream impl.ZipFileOutputStream(String pathname) Instantiates a new zip file output stream impl.ZipFileOutputStream(String parent, String child) Instantiates a new zip file output stream impl.ZipFileOutputStream(URI uri) Instantiates a new zip file output stream impl. -
Method Summary
Modifier and TypeMethodDescriptionprotected static OutputStreamtoOutputStream(File aFile) Returns anOutputStreamto the providedFile.Methods inherited from class java.io.BufferedOutputStream
flush, write, writeMethods inherited from class java.io.FilterOutputStream
close, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ZipFileOutputStream
Instantiates a new zip file output stream impl.- Parameters:
parent- the parentchild- the child- Throws:
ZipException- the zip exceptionFileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
Instantiates a new zip file output stream impl.- Parameters:
parent- the parentchild- the child- Throws:
ZipException- the zip exceptionFileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
Instantiates a new zip file output stream impl.- Parameters:
pathname- the pathname- Throws:
ZipException- the zip exceptionFileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
Instantiates a new zip file output stream impl.- Parameters:
uri- the uri- Throws:
ZipException- the zip exceptionFileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
Instantiates a new zip file output stream impl.- Parameters:
aFile- the file- Throws:
ZipException- the zip exceptionFileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
-
Method Details
-
toOutputStream
Returns anOutputStreamto the providedFile. In case the file points to a ZIP compressed file (it has the file suffix ".zip"), then the data written to theOutputStreamis being ZIP compressed.- Parameters:
aFile- TheFilefor which to get theOutputStream.- Returns:
- An
OutputStream, in case of a ZIP compressedFilewas specified (with suffix ".zip"), then a compressedOutputStreamis returned. - Throws:
ZipException- in case there were problems when accessing the ZIP compressedFile.IOException- in case there were problems working with theFile.FileNotFoundException- in case there was none suchFilefound.
-