|
|||||||||
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 java.util.zip.ZipFile |
archive()
Returns the file this locator presents as opened zip file or null in any case of error. |
protected java.util.zip.ZipEntry |
archiveEntry()
|
protected java.util.zip.ZipFile |
container()
Returns the zip file which is presented by the parent container or null in any case of error. |
protected java.io.File |
convertFromURLSyntax(java.io.File file)
|
static FileLocator |
create(java.io.File file)
Create a file locator that corresponds to the given file name. |
static FileLocator |
create(java.lang.String filename)
Create a file locator that corresponds to the given file name. |
protected FileLocator |
createFrom(java.io.File filePath)
|
protected boolean |
doesElementExist(java.io.File element)
|
protected boolean |
doesElementExistInArchive(java.lang.String elementName)
|
protected void |
doesNotExist(java.io.File file)
|
protected java.util.zip.ZipEntry |
entryFromArchive(java.lang.String elementName)
|
java.lang.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 java.io.File |
fileRef()
|
protected FileUtil |
fileUtil()
|
protected java.io.File |
fullFilePath(boolean absolute)
|
java.lang.String |
getAbsolutePath()
Returns the full absolute pathname. |
protected java.lang.Exception |
getException()
|
protected boolean |
getExists()
|
protected java.io.File |
getFile()
|
java.io.InputStream |
getInputStream()
Returns an opened input stream on the file defined by this locator. |
protected FileLocator |
getParent()
|
java.lang.String |
getPath()
Returns the full pathname. |
java.lang.String |
getStandardizedAbsolutePath()
Returns the full absolute pathname in a standardized form. |
java.lang.String |
getStandardizedPath()
Returns the full pathname in a standardized for. |
protected java.util.zip.ZipFile |
getZipFile()
|
protected FileLocator |
initFromPath(java.lang.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(java.io.File element)
|
protected boolean |
isFileInArchive(java.lang.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. |
java.io.File |
realFile()
Returns the file that contains the data the locator points to. |
protected void |
setException(java.lang.Exception newValue)
|
protected void |
setExists(boolean newValue)
|
protected void |
setFile(java.io.File newValue)
|
protected void |
setParent(FileLocator newValue)
|
protected void |
setZipFile(java.util.zip.ZipFile newValue)
|
long |
size()
Returns the size of the file or 0 if it does not exist. |
protected StringUtil |
str()
|
java.net.URL |
toURL()
Returns the name of the file as an URL. |
protected void |
urlPath(java.lang.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 java.io.File getFile()
protected void setFile(java.io.File newValue)
protected java.util.zip.ZipFile getZipFile()
protected void setZipFile(java.util.zip.ZipFile newValue)
protected boolean getExists()
protected void setExists(boolean newValue)
protected java.lang.Exception getException()
protected void setException(java.lang.Exception newValue)
public static FileLocator create(java.io.File file)
public static FileLocator create(java.lang.String filename)
public java.io.File realFile()
public boolean exists()
public boolean isFile()
public boolean isDirectory()
public long size()
public long lastModified()
public java.io.InputStream getInputStream() throws java.lang.Exception
java.lang.Exception
public boolean isInArchive()
public java.lang.String getPath()
public java.lang.String getAbsolutePath()
public java.lang.String getStandardizedPath()
public java.lang.String getStandardizedAbsolutePath()
public java.lang.Exception exception()
public java.net.URL toURL() throws java.net.MalformedURLException
java.net.MalformedURLException
protected FileLocator createFrom(java.io.File filePath)
protected FileLocator initFromPath(java.lang.String[] parts, boolean startsFromRoot) throws java.lang.Exception
java.lang.Exception
protected boolean doesElementExist(java.io.File element) throws java.lang.Exception
java.lang.Exception
protected boolean isFileElement(java.io.File element) throws java.lang.Exception
java.lang.Exception
protected boolean doesElementExistInArchive(java.lang.String elementName) throws java.lang.Exception
java.lang.Exception
protected boolean isFileInArchive(java.lang.String elementName) throws java.lang.Exception
java.lang.Exception
protected java.util.zip.ZipEntry entryFromArchive(java.lang.String elementName) throws java.lang.Exception
java.lang.Exception
protected java.util.zip.ZipEntry archiveEntry() throws java.lang.Exception
java.lang.Exception
protected void doesNotExist(java.io.File file)
protected java.io.File fullFilePath(boolean absolute)
protected void urlPath(java.lang.StringBuffer buffer)
protected java.io.File fileRef() throws java.lang.Exception
java.lang.Exception
protected java.util.zip.ZipFile archive() throws java.lang.Exception
java.lang.Exception
protected java.util.zip.ZipFile container() throws java.lang.Exception
java.lang.Exception
protected java.io.File convertFromURLSyntax(java.io.File file)
protected StringUtil str()
protected FileUtil fileUtil()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |