public class ClasspathElement
extends java.lang.Object
Constructor and Description |
---|
ClasspathElement(java.io.File aFile)
Initialize the new instance with a file representing either a directory
or an archive file.
|
ClasspathElement(java.lang.String elementName)
Initialize the new instance with default values.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
archiveContainsFile(java.lang.String filename) |
protected boolean |
checkArchive() |
void |
close()
Close any underlying (maybe) opened archive
|
boolean |
contains(java.lang.String filename)
Returns whether or not this element contains a file with the given name.
|
java.net.URL |
createURL(java.lang.String filename)
Creates a URL for the file with the given name that is in this file
container.
|
protected void |
debug(java.lang.String text) |
protected boolean |
dirContainsFile(java.lang.String filename) |
boolean |
equals(java.lang.Object object)
Returns true if the given object is equal to this object
|
boolean |
exists()
Returns whether or not this classpath element exists.
|
protected FileUtil |
futil() |
protected java.io.File |
getFile() |
protected java.util.zip.ZipEntry |
getFileFromArchive(java.lang.String filename) |
protected java.io.File |
getFileFromDirectory(java.lang.String filename) |
FileInfo |
getFileInfo(java.lang.String filename)
Returns a file info object for the given filename which is expected
to be inside the directory or archive represented by this classpath element.
|
protected java.lang.String |
getId() |
java.lang.String |
getName()
Returns the name of this classpath element
|
java.net.URL |
getURL()
Returns a URL that points to this classpath element.
|
protected boolean |
getValid() |
protected java.util.zip.ZipFile |
getZipFile()
Opens and returns the zip file.
|
protected void |
handleException(java.lang.Exception ex) |
int |
hashCode()
Returns the hash value of this object
|
protected void |
init(java.io.File aFile) |
boolean |
isArchive()
Returns true, if this element is an archive file.
|
boolean |
isDirectory()
Returns true, if this element is a directory
|
boolean |
isFile()
Returns true, if this element is a file.
|
boolean |
isOpen()
Returns true, if this element represents an archive (zip file) and that
archive is currently open.
|
boolean |
isValid()
Returns true, if this element is either a valid directory or really an
archive (zip file).
|
boolean |
leaveArchiveOpen()
Returns true, if an opened archive stays open until method close()
gets called.
|
void |
leaveArchiveOpen(boolean newValue)
Sets whether an opened archive stays open until method close()
gets called.
|
protected Logger |
logger() |
java.io.InputStream |
open(java.lang.String filename)
Opens the file with the given name in this classpath element and returns
the input stream.
|
protected void |
setFile(java.io.File newValue) |
protected void |
setId(java.lang.String newValue) |
protected void |
setName(java.lang.String newValue) |
protected void |
setValid(boolean newValue) |
protected void |
setZipFile(java.util.zip.ZipFile newValue) |
protected SysUtil |
sys() |
java.lang.String |
toString()
Returns the element's string representation.
|
public ClasspathElement(java.io.File aFile)
aFile
- A file representing an element in a classpathpublic ClasspathElement(java.lang.String elementName)
public java.lang.String getName()
public boolean leaveArchiveOpen()
close()
public void leaveArchiveOpen(boolean newValue)
close()
public boolean exists()
public boolean isFile()
public boolean isArchive()
public boolean isDirectory()
public boolean isValid()
public boolean isOpen()
public boolean contains(java.lang.String filename)
filename
- The name of the file to be looked forpublic FileInfo getFileInfo(java.lang.String filename)
filename
- The name of the file to be looked forpublic java.io.InputStream open(java.lang.String filename) throws java.io.IOException
filename
- The name of the file in this container to be openedjava.io.IOException
public void close()
public java.net.URL getURL()
public java.net.URL createURL(java.lang.String filename)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
protected void init(java.io.File aFile)
protected boolean checkArchive()
protected boolean dirContainsFile(java.lang.String filename)
protected java.io.File getFileFromDirectory(java.lang.String filename)
protected boolean archiveContainsFile(java.lang.String filename)
protected java.util.zip.ZipEntry getFileFromArchive(java.lang.String filename)
protected java.util.zip.ZipFile getZipFile() throws java.util.zip.ZipException, java.io.IOException
java.util.zip.ZipException
java.io.IOException
close()
protected void handleException(java.lang.Exception ex)
protected void setName(java.lang.String newValue)
protected java.io.File getFile()
protected void setFile(java.io.File newValue)
protected boolean getValid()
protected void setValid(boolean newValue)
protected java.lang.String getId()
protected void setId(java.lang.String newValue)
protected void setZipFile(java.util.zip.ZipFile newValue)
protected void debug(java.lang.String text)
protected Logger logger()
protected FileUtil futil()
protected SysUtil sys()