org.apache.tools.ant.types.resources
public class URLResource extends Resource implements URLProvider
Since: Ant 1.7
Constructor Summary | |
---|---|
URLResource()
Default constructor. | |
URLResource(URL u)
Convenience constructor. | |
URLResource(URLProvider u)
Convenience constructor. | |
URLResource(File f)
Convenience constructor. | |
URLResource(String u)
String constructor for Ant attribute introspection. |
Method Summary | |
---|---|
protected void | connect()
Ensure that we have a connection. |
boolean | equals(Object another)
Test whether an Object equals this URLResource. |
InputStream | getInputStream()
Get an InputStream for the Resource. |
long | getLastModified()
Tells the modification time in milliseconds since 01.01.1970 .
|
String | getName()
Get the name of this URLResource
(its file component minus the leading separator). |
OutputStream | getOutputStream()
Get an OutputStream for the Resource. |
long | getSize()
Get the size of this Resource. |
URL | getURL()
Get the URL used by this URLResource. |
int | hashCode()
Get the hash code for this Resource. |
boolean | isDirectory()
Tells if the resource is a directory. |
boolean | isExists()
Find out whether the URL exists . |
void | setBaseURL(URL base)
Base URL which combined with the relativePath attribute defines
the URL. |
void | setFile(File f)
Set the URL from a File. |
void | setRefid(Reference r)
Overrides the super version. |
void | setRelativePath(String r)
Relative path which combined with the baseURL attribute defines
the URL. |
void | setURL(URL u)
Set the URL for this URLResource. |
String | toString()
Return this URLResource formatted as a String. |
Parameters: u the URL to expose.
Parameters: u holds the URL to expose.
Parameters: f the File to set as a URL.
Parameters: u String representation of this URL.
See Also: IntrospectionHelper
Throws: IOException if the connection cannot be established.
Parameters: another the other Object to compare.
Returns: true if the specified Object is equal to this Resource.
Returns: an InputStream containing this Resource's content.
Throws: IOException if unable to provide the content of this Resource as a stream. UnsupportedOperationException if InputStreams are not supported for this Resource type.
Returns: 0 if the resource does not exist to mirror the behavior
of java.io.File File
.
Returns: the name of this resource.
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. IOException if the URL cannot be opened.
Returns: the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.
Returns: a URL object.
Returns: hash code as int.
Returns: boolean whether the resource is a directory.
Returns: true if this resource exists.
Since: Ant 1.8.0
Parameters: f the File to set as a URL.
Parameters: r the Reference to set.
Since: Ant 1.8.0
Parameters: u the URL to expose.
Returns: a String representation of this URLResource.