org.apache.tools.ant.types.resources
public class FileResource extends Resource implements Touchable, FileProvider, ResourceFactory, Appendable
Since: Ant 1.7
Constructor Summary | |
---|---|
FileResource()
Default constructor. | |
FileResource(File b, String name)
Construct a new FileResource using the specified basedir and relative name. | |
FileResource(File f)
Construct a new FileResource from a File. | |
FileResource(Project p, File f)
Create a new FileResource. | |
FileResource(Project p, String s)
Constructor for Ant attribute introspection. |
Method Summary | |
---|---|
int | compareTo(Object another)
Compare this FileResource to another Resource. |
boolean | equals(Object another)
Compare another Object to this FileResource for equality. |
OutputStream | getAppendOutputStream() |
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. |
Resource | getResource(String path)
Create a new resource that matches a relative or absolute path.
|
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. |
Parameters: b the basedir as File. name the relative filename.
Parameters: f the File represented.
Parameters: p Project f File represented
Since: Ant 1.8
Parameters: p the Project against which to resolve s
. s the absolute or Project-relative filename as a String.
See Also: IntrospectionHelper
Parameters: another the other Resource against which to compare.
Returns: a negative integer, zero, or a positive integer as this FileResource is less than, equal to, or greater than the specified Resource.
Parameters: another the other Object to compare.
Returns: true if another is a FileResource representing the same file.
Returns: the basedir as File.
Returns: the File.
Returns: an InputStream object.
Throws: IOException if an error occurs.
Returns: 0 if the resource does not exist.
Returns: the name of this resource.
Returns: the not-null File.
Throws: BuildException if file is null.
Returns: an OutputStream to which content can be written.
Throws: IOException if unable to provide the content of this Resource as a stream. UnsupportedOperationException if OutputStreams are not supported for this Resource type.
Parameters: path relative/absolute path to a resource
Returns: a new resource of type FileResource
Throws: BuildException if desired
Since: Ant1.8
Returns: the size, as a long, 0 if the Resource does not exist.
Returns: hash code as int.
Returns: boolean flag indicating if the resource is a directory.
Returns: true if this resource exists.
Returns: whether this Resource is a FileResource.
Parameters: b the basedir as File.
Parameters: f the File to be represented.
Parameters: r the Reference to set.
Returns: this FileResource formatted as a String.
Parameters: modTime new last modification time.