public class JahiaArchiveFileHandler extends Object
| Constructor and Description |
|---|
JahiaArchiveFileHandler(String path)
Constructor
|
JahiaArchiveFileHandler(String path,
String basePath) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeArchiveFile()
Close the Zip file.
|
protected void |
copyStream(InputStream ins,
OutputStream outs)
Copy an InputStream to an OutPutStream
|
boolean |
entryExists(String entryName)
Check if an entry exist or not
|
String |
extractContent(String entryName)
Extracts the content of the specifdied archive entry as a text.
|
void |
extractEntry(String entryName,
String destPath)
Extract an entry in a gived folder.
|
File |
extractFile(String entryName)
Extract an entry of file type in the jar file
Return a File Object reference to the uncompressed file
|
protected String |
genPathFile(String entryName)
Generates a file path for a given entry name
Parses "/" char and replaces them with File.separator char
|
ZipEntry |
getEntry(String entryName)
Return an entry in the jar file of the gived name or null if not found
|
String |
getPath() |
boolean |
isDirectory(String entryName)
Check if an entry is a directory or not
|
void |
unzip()
Decompresses the file in it's current location
|
Map<String,String> |
unzip(String path)
Decompress the file in a given folder
|
Map<String,String> |
unzip(String path,
boolean overwrite) |
Map<String,String> |
unzip(String path,
boolean overwrite,
PathFilter pathFilter,
String pathPrefix) |
Map<String,String> |
unzip(String path,
PathFilter pathFilter) |
public JahiaArchiveFileHandler(String path) throws IOException
path, - the full path to the fileIOExceptionpublic JahiaArchiveFileHandler(String path, String basePath) throws IOException
IOExceptionpublic void unzip()
throws JahiaException
JahiaExceptionpublic Map<String,String> unzip(String path) throws JahiaException
path - JahiaExceptionpublic Map<String,String> unzip(String path, PathFilter pathFilter) throws JahiaException
JahiaExceptionpublic Map<String,String> unzip(String path, boolean overwrite) throws JahiaException
JahiaExceptionpublic Map<String,String> unzip(String path, boolean overwrite, PathFilter pathFilter, String pathPrefix) throws JahiaException
JahiaExceptionpublic File extractFile(String entryName) throws IOException, JahiaArchiveFileException
entryName, - the entry nameIOExceptionJahiaArchiveFileExceptionpublic String extractContent(String entryName) throws IOException, JahiaArchiveFileException
entryName - the archive entry nameIOExceptionJahiaArchiveFileExceptionpublic void extractEntry(String entryName, String destPath) throws JahiaException
entryName, - the name of an entry in the jardestPath, - the path to the destination folderJahiaExceptionpublic ZipEntry getEntry(String entryName)
entryName - the entry namepublic boolean isDirectory(String entryName)
(String) - entryName the entry namepublic boolean entryExists(String entryName)
(String) - entryName the entry namepublic void closeArchiveFile()
protected String genPathFile(String entryName)
protected void copyStream(InputStream ins, OutputStream outs) throws IOException
ins - An InputStream.outs - An OutputStream.IOException.IOExceptionpublic String getPath()
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.