public class ZipFilePath extends ZipDirectoryPath implements FilePath, DirectoryPath
This class represents a path which could be considered as a FilePath
and as a DirectoryPath
with a
ZIP archive behind the scene. It is a directory since we can consider its entries as children and a path since we can
directly read the archive.
Constructor and Description |
---|
ZipFilePath(File file,
DirectoryPath parent)
Builds a new instance with the file name as path name.
|
ZipFilePath(File file,
String name,
DirectoryPath parent)
Builds a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected String |
absoluteEntryOf(String child)
Gets the absolute entry name of the given
String built relatively to this directory's archive. |
long |
getLastUpdate()
Gets the last update date of this path.
|
File |
getRawFile()
Gets the concrete path pointing to the archive on path system.
|
protected ZipFile |
getZipFile()
Gets the ZIP file related to this directory.
|
String[] |
list()
Lists all the children path names of this directory.
|
String[] |
list(String baseEntry)
Lists all the entries in the archive relatively to the given root entry name.
|
InputStream |
openStream()
Opens a stream to the path represented by this path.
|
buildChild
getChild
getAbsolutePath, getName, getParent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChild
getAbsolutePath, getName, getParent
public ZipFilePath(File file, DirectoryPath parent) throws IOException
Builds a new instance with the file name as path name.
file
- the pathparent
- the parentIOException
- if any I/O error occurspublic ZipFilePath(File file, String name, DirectoryPath parent) throws IOException
Builds a new instance. Throws an IllegalArgumentException
if the given path is not a ZIP archive.
file
- the pathname
- the nameparent
- the parentIOException
- if any I/O error occurspublic File getRawFile()
Gets the concrete path pointing to the archive on path system.
public InputStream openStream() throws IOException
Opens a stream to the path represented by this path.
openStream
in interface FilePath
IOException
- if stream can't be openedpublic String[] list() throws IOException
Lists all the children path names of this directory.
list
in interface DirectoryPath
IOException
- if any I/O error occurspublic String[] list(String baseEntry) throws IOException
Lists all the entries in the archive relatively to the given root entry name.
baseEntry
- the root entryIOException
- if any I/O error occursprotected ZipFile getZipFile() throws IOException
Gets the ZIP file related to this directory.
getZipFile
in class ZipDirectoryPath
IOException
- if any I/O error occurspublic long getLastUpdate()
Gets the last update date of this path.
getLastUpdate
in interface Path
protected String absoluteEntryOf(String child) throws IOException
Gets the absolute entry name of the given String
built relatively to this directory's archive.
absoluteEntryOf
in class ZipDirectoryPath
IOException
- if any I/O error occursCopyright © 2012-2015. All Rights Reserved.