|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pf.file.FileLocator
public class FileLocator
This class mainly supports access to files which can be in the normal
file directory structure or inside zip archives.
The main purpose is to provide methods that transparently treat files
the same way whether they are in the normal directory structure or
inside archives.
The syntax is simply to allow archive names in a path name at any place
where a sub-directory name can be.
Examples:
Method Summary | |
---|---|
protected ZipFile |
archive()
Returns the file this locator presents as opened zip file or null in any case of error. |
protected ZipEntry |
archiveEntry()
|
protected ZipFile |
container()
Returns the zip file which is presented by the parent container or null in any case of error. |
protected File |
convertFromURLSyntax(File file)
|
static FileLocator |
create(File file)
Create a file locator that corresponds to the given file name. |
static FileLocator |
create(String filename)
Create a file locator that corresponds to the given file name. |
protected FileLocator |
createFrom(File filePath)
|
protected boolean |
doesElementExist(File element)
|
protected boolean |
doesElementExistInArchive(String elementName)
|
protected void |
doesNotExist(File file)
|
protected ZipEntry |
entryFromArchive(String elementName)
|
Exception |
exception()
Returns the last exception that occured while using this locator or null, if no exception was thrown at all. |
boolean |
exists()
Returns whether or not the file specified by this locator exists. |
protected File |
fileRef()
|
protected FileUtil |
fileUtil()
|
protected File |
fullFilePath(boolean absolute)
|
String |
getAbsolutePath()
Returns the full absolute pathname. |
protected Exception |
getException()
|
protected boolean |
getExists()
|
protected File |
getFile()
|
InputStream |
getInputStream()
Returns an opened input stream on the file defined by this locator. |
protected FileLocator |
getParent()
|
String |
getPath()
Returns the full pathname. |
String |
getStandardizedAbsolutePath()
Returns the full absolute pathname in a standardized form. |
String |
getStandardizedPath()
Returns the full pathname in a standardized for. |
protected ZipFile |
getZipFile()
|
protected FileLocator |
initFromPath(String[] parts,
boolean startsFromRoot)
|
boolean |
isDirectory()
Returns whether or not the name specified by this locator points to a directory. |
boolean |
isFile()
Returns whether or not the name specified by this locator points to a file. |
protected boolean |
isFileElement(File element)
|
protected boolean |
isFileInArchive(String elementName)
|
boolean |
isInArchive()
Returns whether or not the file specified by this locator is inside an archive. |
long |
lastModified()
Returns the timestamp of when the file was last modified or 0 in any case of error. |
File |
realFile()
Returns the file that contains the data the locator points to. |
protected void |
setException(Exception newValue)
|
protected void |
setExists(boolean newValue)
|
protected void |
setFile(File newValue)
|
protected void |
setParent(FileLocator newValue)
|
protected void |
setZipFile(ZipFile newValue)
|
long |
size()
Returns the size of the file or 0 if it does not exist. |
protected StringUtil |
str()
|
URL |
toURL()
Returns the name of the file as an URL. |
protected void |
urlPath(StringBuffer buffer)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected FileLocator getParent()
protected void setParent(FileLocator newValue)
protected File getFile()
protected void setFile(File newValue)
protected ZipFile getZipFile()
protected void setZipFile(ZipFile newValue)
protected boolean getExists()
protected void setExists(boolean newValue)
protected Exception getException()
protected void setException(Exception newValue)
public static FileLocator create(File file)
public static FileLocator create(String filename)
public File realFile()
public boolean exists()
public boolean isFile()
public boolean isDirectory()
public long size()
public long lastModified()
public InputStream getInputStream() throws Exception
Exception
public boolean isInArchive()
public String getPath()
public String getAbsolutePath()
public String getStandardizedPath()
public String getStandardizedAbsolutePath()
public Exception exception()
public URL toURL() throws MalformedURLException
MalformedURLException
protected FileLocator createFrom(File filePath)
protected FileLocator initFromPath(String[] parts, boolean startsFromRoot) throws Exception
Exception
protected boolean doesElementExist(File element) throws Exception
Exception
protected boolean isFileElement(File element) throws Exception
Exception
protected boolean doesElementExistInArchive(String elementName) throws Exception
Exception
protected boolean isFileInArchive(String elementName) throws Exception
Exception
protected ZipEntry entryFromArchive(String elementName) throws Exception
Exception
protected ZipEntry archiveEntry() throws Exception
Exception
protected void doesNotExist(File file)
protected File fullFilePath(boolean absolute)
protected void urlPath(StringBuffer buffer)
protected File fileRef() throws Exception
Exception
protected ZipFile archive() throws Exception
Exception
protected ZipFile container() throws Exception
Exception
protected File convertFromURLSyntax(File file)
protected StringUtil str()
protected FileUtil fileUtil()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |