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, count
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorDescriptionZipFileOutputStream
(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 OutputStream
toOutputStream
(File aFile) Returns anOutputStream
to the providedFile
.Methods inherited from class java.io.BufferedOutputStream
flush, write, write
Methods inherited from class java.io.FilterOutputStream
close, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ZipFileOutputStream
public ZipFileOutputStream(File parent, String child) throws ZipException, FileNotFoundException, IOException 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
public ZipFileOutputStream(String parent, String child) throws ZipException, FileNotFoundException, IOException 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
protected static OutputStream toOutputStream(File aFile) throws ZipException, IOException, FileNotFoundException Returns anOutputStream
to the providedFile
. In case the file points to a ZIP compressed file (it has the file suffix ".zip"), then the data written to theOutputStream
is being ZIP compressed.- Parameters:
aFile
- TheFile
for which to get theOutputStream
.- Returns:
- An
OutputStream
, in case of a ZIP compressedFile
was specified (with suffix ".zip"), then a compressedOutputStream
is 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 suchFile
found.
-