|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ants.utils.UrlResource
An UrlResource
is an object containing the URL from which the
content of a resource may be downloaded. When a UrlResource
is inserted in a Storage
object, the storage may perform a
local copy of the resource by downloading the contents through the
input stream obtained through the getInputStream()
method.
Constructor Summary | |
UrlResource()
Default constructor for externalization. |
|
UrlResource(String url)
Constructs a new UrlResource identified by the
specified name . |
|
UrlResource(String url,
DocumentKey dockey)
Constructs a new UrlResource identified by the
specified name and dockey .
|
|
UrlResource(URL url)
Constructs a new UrlResource identified by the
specified name . |
Method Summary | |
boolean |
equals(Object obj)
Check whether this UrlResource is equal to the specified object. |
String |
getAttribute(String name)
Returns the value associated to the specified attribute name, or null if there is no attribute with that name. |
long |
getContentLength()
Return the lenght of the content of the resource, if available. |
String |
getFile()
Returns the file part of this URL. |
InputStream |
getInputStream()
Return an input stream to download the contents of the resource. |
Object |
getKey()
Return the document key for this Url resource as the key. |
String |
getName()
Returns the string identifier of the object. |
String |
getURL()
Return the stringified url for this Url resource. |
int |
hashCode()
Returns a hash code value for the object. |
void |
readExternal(ObjectInput in)
Marshals this UrlResource to the specified output stream. |
long |
size()
Return the space required to store the resource object. |
String |
toString()
Returns a string representation of the object. |
void |
writeExternal(ObjectOutput out)
Marshals this UrlResource to the specified output stream. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public UrlResource()
public UrlResource(URL url) throws IOException
UrlResource
identified by the
specified name
. This will compute the hash and the length of
the referenced file.
NON-SIMULATION VERSION
url
- url from which the resource may be downloadedpublic UrlResource(String url)
UrlResource
identified by the
specified name
. This is for simulation and will generate a
random document identifier for the referenced file.
SIMULATION VERSION.
url
- url from which the resource may be downloadedpublic UrlResource(String url, DocumentKey dockey)
UrlResource
identified by the
specified name
and dockey
.
SIMULATION VERSION.
url
- url from which the resource may be downloadeddockey
- DocumentKey
for the specified URL.Method Detail |
public String getName()
getName
in interface Resource
public String getAttribute(String name)
getAttribute
in interface Resource
name
- the name of the attributepublic InputStream getInputStream() throws IOException
getInputStream
in interface Resource
IOException
public long getContentLength()
getContentLength
in interface Resource
public long size()
Resource
size
in interface Resource
public Object getKey()
getKey
in interface Resource
public String getURL()
public String getFile()
String
valuepublic boolean equals(Object obj)
UrlResource
is equal to the specified object.
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public void readExternal(ObjectInput in) throws IOException
UrlResource
to the specified output stream.
readExternal
in interface Externalizable
IOException
public void writeExternal(ObjectOutput out) throws IOException
UrlResource
to the specified output stream.
writeExternal
in interface Externalizable
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |