org.apache.tools.ant.types.resources
Class FileResource
- Cloneable, Comparable, ResourceCollection, Touchable
public class FileResource
A Resource representation of a File.
FileResource() - Default constructor.
|
FileResource(File f) - Construct a new FileResource from a File.
|
FileResource(File b, String name) - Construct a new FileResource using the specified basedir and relative name.
|
FileResource(Project p, String s) - Constructor for Ant attribute introspection.
|
int | compareTo(Object another) - Compare this FileResource to another Resource.
|
boolean | equals(Object another) - Compare another Object to this FileResource for equality.
|
File | getBaseDir() - Return the basedir to which the name is relative.
|
File | getFile() - Get the file represented by this FileResource.
|
InputStream | getInputStream() - Return an InputStream for reading the contents of this Resource.
|
long | getLastModified() - Get the modification time in milliseconds since 01.01.1970 .
|
String | getName() - Get the name of this FileResource.
|
protected File | getNotNullFile() - Get the file represented by this FileResource, ensuring it is not null.
|
OutputStream | getOutputStream() - Get an OutputStream for the Resource.
|
long | getSize() - Get the size of this Resource.
|
int | hashCode() - Get the hash code for this Resource.
|
boolean | isDirectory() - Learn whether the resource is a directory.
|
boolean | isExists() - Learn whether this file exists.
|
boolean | isFilesystemOnly() - Fulfill the ResourceCollection contract.
|
void | setBaseDir(File b) - Set the basedir for this FileResource.
|
void | setFile(File f) - Set the File for this FileResource.
|
void | setRefid(Reference r) - Overrides the super version.
|
String | toString() - Get the string representation of this Resource.
|
void | touch(long modTime) - Implement the Touchable interface.
|
clone , compareTo , equals , getInputStream , getLastModified , getMagicNumber , getName , getOutputStream , getSize , hashCode , isDirectory , isExists , isFilesystemOnly , iterator , setDirectory , setExists , setLastModified , setName , setRefid , setSize , size , toLongString , toString |
checkAttributesAllowed , checkChildrenAllowed , circularReference , clone , dieOnCircularReference , dieOnCircularReference , dieOnCircularReference , getCheckedRef , getCheckedRef , getCheckedRef , getCheckedRef , getDataTypeName , getRefid , invokeCircularReferenceCheck , isChecked , isReference , noChildrenAllowed , setChecked , setRefid , toString , tooManyAttributes |
FileResource
public FileResource()
Default constructor.
FileResource
public FileResource(File f)
Construct a new FileResource from a File.
f
- the File represented.
FileResource
public FileResource(File b,
String name)
Construct a new FileResource using the specified basedir and relative name.
b
- the basedir as File.name
- the relative filename.
FileResource
public FileResource(Project p,
String s)
Constructor for Ant attribute introspection.
p
- the Project against which to resolve s
.s
- the absolute or Project-relative filename as a String.
compareTo
public int compareTo(Object another)
Compare this FileResource to another Resource.
- compareTo in interface Resource
another
- the other Resource against which to compare.
- a negative integer, zero, or a positive integer as this FileResource
is less than, equal to, or greater than the specified Resource.
equals
public boolean equals(Object another)
Compare another Object to this FileResource for equality.
- equals in interface Resource
another
- the other Object to compare.
- true if another is a FileResource representing the same file.
getBaseDir
public File getBaseDir()
Return the basedir to which the name is relative.
getFile
public File getFile()
Get the file represented by this FileResource.
getInputStream
public InputStream getInputStream()
throws IOException
Return an InputStream for reading the contents of this Resource.
- getInputStream in interface Resource
getLastModified
public long getLastModified()
Get the modification time in milliseconds since 01.01.1970 .
- getLastModified in interface Resource
- 0 if the resource does not exist.
getName
public String getName()
Get the name of this FileResource. If the basedir is set,
the name will be relative to that. Otherwise the basename
only will be returned.
- getName in interface Resource
- the name of this resource.
getNotNullFile
protected File getNotNullFile()
Get the file represented by this FileResource, ensuring it is not null.
getOutputStream
public OutputStream getOutputStream()
throws IOException
Get an OutputStream for the Resource.
- getOutputStream in interface Resource
- an OutputStream to which content can be written.
getSize
public long getSize()
Get the size of this Resource.
- getSize in interface Resource
- the size, as a long, 0 if the Resource does not exist.
hashCode
public int hashCode()
Get the hash code for this Resource.
- hashCode in interface Resource
isDirectory
public boolean isDirectory()
Learn whether the resource is a directory.
- isDirectory in interface Resource
- boolean flag indicating if the resource is a directory.
isExists
public boolean isExists()
Learn whether this file exists.
- isExists in interface Resource
- true if this resource exists.
setBaseDir
public void setBaseDir(File b)
Set the basedir for this FileResource.
setFile
public void setFile(File f)
Set the File for this FileResource.
f
- the File to be represented.
setRefid
public void setRefid(Reference r)
Overrides the super version.
- setRefid in interface Resource
r
- the Reference to set.
toString
public String toString()
Get the string representation of this Resource.
- toString in interface Resource
- this FileResource formatted as a String.
touch
public void touch(long modTime)
Implement the Touchable interface.
- touch in interface Touchable
modTime
- new last modification time.