public class URLResource extends Resource implements URLProvider
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZE
description, location, project
Constructor and Description |
---|
URLResource()
Default constructor.
|
URLResource(java.io.File f)
Convenience constructor.
|
URLResource(java.lang.String u)
String constructor for Ant attribute introspection.
|
URLResource(java.net.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(java.lang.Object another)
Test whether an Object equals this URLResource.
|
java.io.InputStream |
getInputStream()
Get an InputStream for the Resource.
|
long |
getLastModified()
Tells the modification time in milliseconds since 01.01.1970 .
|
java.lang.String |
getName()
Get the name of this URLResource
(its file component minus the leading separator).
|
java.io.OutputStream |
getOutputStream()
Get an OutputStream for the Resource.
|
long |
getSize()
Get the size of this Resource.
|
java.net.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(java.net.URL base)
Base URL which combined with the relativePath attribute defines
the URL.
|
void |
setFile(java.io.File f)
Set the URL from a File.
|
void |
setRefid(Reference r)
Overrides the super version.
|
void |
setRelativePath(java.lang.String r)
Relative path which combined with the baseURL attribute defines
the URL.
|
void |
setURL(java.net.URL u)
Set the URL for this URLResource.
|
java.lang.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(java.net.URL u)
u
- the URL to expose.public URLResource(URLProvider u)
u
- holds the URL to expose.public URLResource(java.io.File f)
f
- the File to set as a URL.public URLResource(java.lang.String u)
u
- String representation of this URL.IntrospectionHelper
public void setURL(java.net.URL u)
u
- the URL to expose.public void setFile(java.io.File f)
f
- the File to set as a URL.public void setBaseURL(java.net.URL base)
public void setRelativePath(java.lang.String r)
public java.net.URL getURL()
getURL
in interface URLProvider
public void setRefid(Reference r)
public java.lang.String getName()
public java.lang.String toString()
public boolean isExists()
public long getLastModified()
getLastModified
in class Resource
File
.public boolean isDirectory()
isDirectory
in class Resource
public long getSize()
public boolean equals(java.lang.Object another)
public int hashCode()
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class Resource
java.io.IOException
- if unable to provide the content of this
Resource as a stream.java.lang.UnsupportedOperationException
- if InputStreams are not
supported for this Resource type.public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class Resource
java.io.IOException
- if unable to provide the content of this
Resource as a stream.java.lang.UnsupportedOperationException
- if OutputStreams are not
supported for this Resource type.java.io.IOException
- if the URL cannot be opened.protected void connect() throws java.io.IOException
java.io.IOException
- if the connection cannot be established.protected void connect(int logLevel) throws java.io.IOException
logLevel
- severity to use when logging connection errors.
Should be one of the MSG_
constants in Project
.java.io.IOException
- if the connection cannot be established.