public class URLResource extends Resource implements URLProvider
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZE
Constructor and Description |
---|
URLResource()
Default constructor.
|
URLResource(File f)
Convenience constructor.
|
URLResource(String u)
String constructor for Ant attribute introspection.
|
URLResource(URL u)
Convenience constructor.
|
URLResource(URLProvider u)
Convenience constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
connect()
Ensure that we have a connection.
|
protected void |
connect(int logLevel)
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.
|
as, clone, compareTo, getMagicNumber, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setSize, size, toLongString
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
public URLResource()
public URLResource(File f)
f
- the File to set as a URL.public URLResource(String u)
u
- String representation of this URL.IntrospectionHelper
public URLResource(URL u)
u
- the URL to expose.public URLResource(URLProvider u)
u
- holds the URL to expose.protected void connect() throws IOException
IOException
- if the connection cannot be established.protected void connect(int logLevel) throws IOException
logLevel
- severity to use when logging connection errors.
Should be one of the MSG_
constants in Project
.IOException
- if the connection cannot be established.public boolean equals(Object another)
equals
in class Resource
another
- the other Object to compare.Object.hashCode()
,
HashMap
public InputStream getInputStream() throws IOException
getInputStream
in class Resource
IOException
- if unable to provide the content of this
Resource as a stream.UnsupportedOperationException
- if InputStreams are not
supported for this Resource type.public long getLastModified()
getLastModified
in class Resource
File
.public String getName()
public OutputStream getOutputStream() throws IOException
getOutputStream
in class Resource
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.public long getSize()
public URL getURL()
getURL
in interface URLProvider
public int hashCode()
hashCode
in class Resource
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean isDirectory()
isDirectory
in class Resource
public boolean isExists()
public void setBaseURL(URL base)
public void setFile(File f)
f
- the File to set as a URL.public void setRefid(Reference r)
public void setRelativePath(String r)
public void setURL(URL u)
u
- the URL to expose.