Package org.refcodes.io
Class ZipFileOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.BufferedOutputStream
-
- org.refcodes.io.ZipFileOutputStream
-
public class ZipFileOutputStream extends java.io.BufferedOutputStream
Represents anOutputStream
to a providedFile
: 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 theOutputStream
.
-
-
Constructor Summary
Constructors Constructor Description ZipFileOutputStream(java.io.File aFile)
Instantiates a new zip file output stream impl.ZipFileOutputStream(java.io.File parent, java.lang.String child)
Instantiates a new zip file output stream impl.ZipFileOutputStream(java.lang.String pathname)
Instantiates a new zip file output stream impl.ZipFileOutputStream(java.lang.String parent, java.lang.String child)
Instantiates a new zip file output stream impl.ZipFileOutputStream(java.net.URI uri)
Instantiates a new zip file output stream impl.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static java.lang.String
toFileNameFromZip(java.lang.String aZipFileName)
To file name from zip.protected static java.io.OutputStream
toOutputStream(java.io.File aFile)
Returns anOutputStream
to the providedFile
.
-
-
-
Constructor Detail
-
ZipFileOutputStream
public ZipFileOutputStream(java.io.File parent, java.lang.String child) throws java.util.zip.ZipException, java.io.FileNotFoundException, java.io.IOException
Instantiates a new zip file output stream impl.- Parameters:
parent
- the parentchild
- the child- Throws:
java.util.zip.ZipException
- the zip exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
public ZipFileOutputStream(java.lang.String parent, java.lang.String child) throws java.util.zip.ZipException, java.io.FileNotFoundException, java.io.IOException
Instantiates a new zip file output stream impl.- Parameters:
parent
- the parentchild
- the child- Throws:
java.util.zip.ZipException
- the zip exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
public ZipFileOutputStream(java.lang.String pathname) throws java.util.zip.ZipException, java.io.FileNotFoundException, java.io.IOException
Instantiates a new zip file output stream impl.- Parameters:
pathname
- the pathname- Throws:
java.util.zip.ZipException
- the zip exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
public ZipFileOutputStream(java.net.URI uri) throws java.util.zip.ZipException, java.io.FileNotFoundException, java.io.IOException
Instantiates a new zip file output stream impl.- Parameters:
uri
- the uri- Throws:
java.util.zip.ZipException
- the zip exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.
-
ZipFileOutputStream
public ZipFileOutputStream(java.io.File aFile) throws java.util.zip.ZipException, java.io.FileNotFoundException, java.io.IOException
Instantiates a new zip file output stream impl.- Parameters:
aFile
- the file- Throws:
java.util.zip.ZipException
- the zip exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.
-
-
Method Detail
-
toOutputStream
protected static java.io.OutputStream toOutputStream(java.io.File aFile) throws java.util.zip.ZipException, java.io.IOException, java.io.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:
java.util.zip.ZipException
- in case there were problems when accessing the ZIP compressedFile
.java.io.IOException
- in case there were problems working with theFile
.java.io.FileNotFoundException
- in case there was none suchFile
found.
-
toFileNameFromZip
protected static java.lang.String toFileNameFromZip(java.lang.String aZipFileName)
To file name from zip.- Parameters:
aZipFileName
- the zip file name- Returns:
- the string
- See Also:
ZipFileInputStream.toFileNameFromZip(String)
-
-