public class ZipFileForPlugin
extends java.lang.Object
构造器和说明 |
---|
ZipFileForPlugin(java.io.File zipFile)
Creates a new Zip File Object with the input file.
|
ZipFileForPlugin(java.lang.String zipFile)
Creates a new Zip File Object with the given zip file path.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addFile(java.io.File sourceFile,
ZipParameters parameters)
Adds input source file to the zip file.
|
void |
addFiles(java.util.ArrayList sourceFileList,
ZipParameters parameters)
Adds the list of input files to the zip file.
|
void |
addFolder(java.io.File path,
ZipParameters parameters)
Adds the folder in the given file object to the zip file.
|
void |
addFolder(java.lang.String path,
ZipParameters parameters)
Adds the folder in the given path to the zip file.
|
void |
addStream(java.io.InputStream inputStream,
ZipParameters parameters)
Creates a new entry in the zip file and adds the content of the inputstream to the
zip file.
|
void |
createZipFile(java.util.ArrayList sourceFileList,
ZipParameters parameters)
Creates a zip file and adds the list of source file(s) to the zip file.
|
void |
createZipFile(java.util.ArrayList sourceFileList,
ZipParameters parameters,
boolean splitArchive,
long splitLength)
Creates a zip file and adds the list of source file(s) to the zip file.
|
void |
createZipFile(java.io.File sourceFile,
ZipParameters parameters)
Creates a zip file and adds the source file to the zip file.
|
void |
createZipFile(java.io.File sourceFile,
ZipParameters parameters,
boolean splitArchive,
long splitLength)
Creates a zip file and adds the source file to the zip file.
|
void |
createZipFileFromFolder(java.io.File folderToAdd,
ZipParameters parameters,
boolean splitArchive,
long splitLength)
Creates a zip file and adds the files/folders from the specified folder to the zip file.
|
void |
createZipFileFromFolder(java.lang.String folderToAdd,
ZipParameters parameters,
boolean splitArchive,
long splitLength)
Creates a zip file and adds the files/folders from the specified folder to the zip file.
|
void |
extractAll(java.lang.String destPath)
Extracts all the files in the given zip file to the input destination path.
|
void |
extractAll(java.lang.String destPath,
UnzipParameters unzipParameters)
Extracts all the files in the given zip file to the input destination path.
|
void |
extractFile(FileHeader fileHeader,
java.lang.String destPath)
Extracts a specific file from the zip file to the destination path.
|
void |
extractFile(FileHeader fileHeader,
java.lang.String destPath,
UnzipParameters unzipParameters)
Extracts a specific file from the zip file to the destination path.
|
void |
extractFile(FileHeader fileHeader,
java.lang.String destPath,
UnzipParameters unzipParameters,
java.lang.String newFileName)
Extracts a specific file from the zip file to the destination path.
|
void |
extractFile(java.lang.String fileName,
java.lang.String destPath)
Extracts a specific file from the zip file to the destination path.
|
void |
extractFile(java.lang.String fileName,
java.lang.String destPath,
UnzipParameters unzipParameters)
Extracts a specific file from the zip file to the destination path.
|
void |
extractFile(java.lang.String fileName,
java.lang.String destPath,
UnzipParameters unzipParameters,
java.lang.String newFileName)
Extracts a specific file from the zip file to the destination path.
|
java.lang.String |
getComment()
Returns the comment set for the Zip file
|
java.lang.String |
getComment(java.lang.String encoding)
Returns the comment set for the Zip file in the input encoding
|
java.io.File |
getFile()
Returns the File object of the zip file
|
FileHeader |
getFileHeader(java.lang.String fileName)
Returns FileHeader if a file header with the given fileHeader
string exists in the zip model: If not returns null
|
java.util.List |
getFileHeaders()
Returns the list of file headers in the zip file.
|
ZipInputStream |
getInputStream(FileHeader fileHeader)
Returns an input stream for reading the contents of the Zip file corresponding
to the input FileHeader.
|
ProgressMonitor |
getProgressMonitor() |
java.util.ArrayList |
getSplitZipFiles()
Returns the full file path+names of all split zip files
in an ArrayList.
|
boolean |
isEncrypted()
Checks to see if the zip file is encrypted
|
boolean |
isRunInThread() |
boolean |
isSplitArchive()
Checks if the zip file is a split archive
|
boolean |
isValidZipFile()
Checks to see if the input zip file is a valid zip file.
|
void |
mergeSplitFiles(java.io.File outputZipFile)
Merges split zip files into a single zip file without the need to extract the
files in the archive
|
void |
removeFile(FileHeader fileHeader)
Removes the file provided in the input file header from the zip file.
|
void |
removeFile(java.lang.String fileName)
Removes the file provided in the input paramters from the zip file.
|
void |
setComment(java.lang.String comment)
Sets comment for the Zip file
|
void |
setFileNameCharset(java.lang.String charsetName)
Zip4j will encode all the file names with the input charset.
|
void |
setPassword(char[] password)
Sets the password for the zip file
|
void |
setPassword(java.lang.String password)
Sets the password for the zip file.
|
void |
setRunInThread(boolean runInThread) |
public ZipFileForPlugin(java.lang.String zipFile) throws ZipException
zipFile
- ZipException
public ZipFileForPlugin(java.io.File zipFile) throws ZipException
zipFile
- ZipException
public void createZipFile(java.io.File sourceFile, ZipParameters parameters) throws ZipException
sourceFile
- - File to be added to the zip fileparameters
- - parameters to create the zip fileZipException
public void createZipFile(java.io.File sourceFile, ZipParameters parameters, boolean splitArchive, long splitLength) throws ZipException
sourceFile
- - File to be added to the zip fileparameters
- - parameters to create the zip filesplitArchive
- - if archive has to be split or notsplitLength
- - if archive has to be split, then length in bytes at which it has to be splitZipException
public void createZipFile(java.util.ArrayList sourceFileList, ZipParameters parameters) throws ZipException
sourceFileList
- - File to be added to the zip fileparameters
- - parameters to create the zip fileZipException
public void createZipFile(java.util.ArrayList sourceFileList, ZipParameters parameters, boolean splitArchive, long splitLength) throws ZipException
sourceFileList
- - File to be added to the zip fileparameters
- - zip parameters for this file listsplitArchive
- - if archive has to be split or notsplitLength
- - if archive has to be split, then length in bytes at which it has to be splitZipException
public void createZipFileFromFolder(java.lang.String folderToAdd, ZipParameters parameters, boolean splitArchive, long splitLength) throws ZipException
folderToAdd
- parameters
- splitArchive
- splitLength
- ZipException
public void createZipFileFromFolder(java.io.File folderToAdd, ZipParameters parameters, boolean splitArchive, long splitLength) throws ZipException
folderToAdd
- parameters
- splitArchive
- splitLength
- ZipException
public void addFile(java.io.File sourceFile, ZipParameters parameters) throws ZipException
sourceFile
- - File to tbe added to the zip fileparameters
- - zip parameters for this fileZipException
public void addFiles(java.util.ArrayList sourceFileList, ZipParameters parameters) throws ZipException
sourceFileList
- parameters
- ZipException
public void addFolder(java.lang.String path, ZipParameters parameters) throws ZipException
path
- parameters
- ZipException
public void addFolder(java.io.File path, ZipParameters parameters) throws ZipException
path
- parameters
- ZipException
public void addStream(java.io.InputStream inputStream, ZipParameters parameters) throws ZipException
inputStream
- parameters
- ZipException
public void extractAll(java.lang.String destPath) throws ZipException
destPath
- ZipException
public void extractAll(java.lang.String destPath, UnzipParameters unzipParameters) throws ZipException
destPath
- unzipParameters
- ZipException
public void extractFile(FileHeader fileHeader, java.lang.String destPath) throws ZipException
fileHeader
- destPath
- ZipException
public void extractFile(FileHeader fileHeader, java.lang.String destPath, UnzipParameters unzipParameters) throws ZipException
fileHeader
- destPath
- unzipParameters
- ZipException
public void extractFile(FileHeader fileHeader, java.lang.String destPath, UnzipParameters unzipParameters, java.lang.String newFileName) throws ZipException
fileHeader
- destPath
- unzipParameters
- newFileName
- ZipException
public void extractFile(java.lang.String fileName, java.lang.String destPath) throws ZipException
fileName
- destPath
- ZipException
public void extractFile(java.lang.String fileName, java.lang.String destPath, UnzipParameters unzipParameters) throws ZipException
fileName
- destPath
- unzipParameters
- ZipException
public void extractFile(java.lang.String fileName, java.lang.String destPath, UnzipParameters unzipParameters, java.lang.String newFileName) throws ZipException
fileName
- destPath
- unzipParameters
- newFileName
- ZipException
public void setPassword(java.lang.String password) throws ZipException
password
- ZipException
public void setPassword(char[] password) throws ZipException
password
- ZipException
public java.util.List getFileHeaders() throws ZipException
ZipException
public FileHeader getFileHeader(java.lang.String fileName) throws ZipException
fileName
- ZipException
public boolean isEncrypted() throws ZipException
ZipException
public boolean isSplitArchive() throws ZipException
ZipException
public void removeFile(java.lang.String fileName) throws ZipException
fileName
- ZipException
public void removeFile(FileHeader fileHeader) throws ZipException
fileHeader
- ZipException
public void mergeSplitFiles(java.io.File outputZipFile) throws ZipException
outputZipFile
- ZipException
public void setComment(java.lang.String comment) throws ZipException
comment
- ZipException
public java.lang.String getComment() throws ZipException
ZipException
public java.lang.String getComment(java.lang.String encoding) throws ZipException
encoding
- ZipException
public void setFileNameCharset(java.lang.String charsetName) throws ZipException
charsetName
- ZipException
public ZipInputStream getInputStream(FileHeader fileHeader) throws ZipException
fileHeader
- ZipException
public boolean isValidZipFile()
public java.util.ArrayList getSplitZipFiles() throws ZipException
ZipException
public ProgressMonitor getProgressMonitor()
public boolean isRunInThread()
public void setRunInThread(boolean runInThread)
public java.io.File getFile()