public class ZipFileWriter
extends java.lang.Object
| Constructor and Description |
|---|
ZipFileWriter(java.lang.String fileName) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(java.io.InputStream in,
java.lang.String entryName) |
void |
addFile(java.io.InputStream in,
java.lang.String entryName,
java.lang.String comment) |
void |
addFile(java.lang.String pathAndFileName,
java.lang.String entryName) |
void |
addFile(java.lang.String pathAndFileName,
java.lang.String entryName,
java.lang.String comment) |
void |
closeFile()
Close the zip file entry opened from startFile(...)
|
void |
closeZip()
Close the zip file.
|
void |
createFolder(java.lang.String entryName,
long time,
java.lang.String comment)
Creates a folder in the zip file
|
java.util.zip.ZipOutputStream |
getZipOutputStream() |
void |
setComment(java.lang.String comment)
Sets a comment to the zipOutputStream.
|
void |
startFile(java.lang.String entryName,
long time)
Opens a zip file entry ready for writing
|
void |
write(byte[] buf,
int size)
Write the buf data to the zip file entry opened from
startFile(...)
|
void |
write(java.io.InputStream in)
Write data from the InputStream to the zip file entry opened from
startFile(...)
|
public ZipFileWriter(java.lang.String fileName)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic void setComment(java.lang.String comment)
comment - public void closeZip()
throws java.io.IOException
java.io.IOExceptionpublic java.util.zip.ZipOutputStream getZipOutputStream()
public void addFile(java.lang.String pathAndFileName,
java.lang.String entryName)
throws java.io.FileNotFoundException,
java.io.IOException
pathAndFileName - is the location of the file to insert into the zip fileentryName - is an optional name that will be used instead of the pathAndFileName
if it's not nulljava.io.FileNotFoundExceptionjava.io.IOExceptionpublic void addFile(java.lang.String pathAndFileName,
java.lang.String entryName,
java.lang.String comment)
throws java.io.FileNotFoundException,
java.io.IOException
pathAndFileName - is the location of the file to insert into the zip fileentryName - is an optional name that will be used instead of the pathAndFileName
if it's not nulljava.io.FileNotFoundExceptionjava.io.IOExceptionpublic void addFile(java.io.InputStream in,
java.lang.String entryName)
throws java.io.IOException
in - - is an InputStream created from the ZipEntryentryName - - is the full path and file namejava.io.IOExceptionpublic void addFile(java.io.InputStream in,
java.lang.String entryName,
java.lang.String comment)
throws java.io.IOException
in - - is an InputStream created from the ZipEntryentryName - - is the full path and file namecomment - - will be added to the ZipEntry if not nulljava.io.IOExceptionpublic void createFolder(java.lang.String entryName,
long time,
java.lang.String comment)
throws java.io.IOException
entryName - is the full path and file nametime - is the source creation timecomment - if not null will be added to the folder.java.io.IOExceptionpublic void startFile(java.lang.String entryName,
long time)
throws java.io.IOException
entryName - is the full path and file namejava.io.IOExceptionpublic void write(java.io.InputStream in)
throws java.io.IOException
in - is an InputStream created from the ZipEntryjava.io.IOExceptionpublic void write(byte[] buf,
int size)
throws java.io.IOException
buf - is the data to writesize - is the size of the bufjava.io.IOExceptionpublic void closeFile()
throws java.io.IOException
java.io.IOException