Class URLResource
- java.lang.Object
-
- org.apache.ivy.plugins.repository.url.URLResource
-
- All Implemented Interfaces:
LocalizableResource,Resource
public class URLResource extends java.lang.Object implements LocalizableResource
-
-
Constructor Summary
Constructors Constructor Description URLResource(java.net.URL url)URLResource(java.net.URL url, TimeoutConstraint timeoutConstraint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resourceclone(java.lang.String cloneName)Clones this resource with a new resource with a different namebooleanexists()Determine if the resource is available.longgetContentLength()Get the resource sizejava.io.FilegetFile()longgetLastModified()Get the date the resource was last modifiedjava.lang.StringgetName()Get the name of the resource.java.net.URLgetURL()booleanisLocal()Is this resource local to this host, i.e. is it on the file system?java.io.InputStreamopenStream()Opens a stream on this resourcejava.lang.StringtoString()
-
-
-
Constructor Detail
-
URLResource
public URLResource(java.net.URL url)
-
URLResource
public URLResource(java.net.URL url, TimeoutConstraint timeoutConstraint)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:ResourceGet the name of the resource.
-
clone
public Resource clone(java.lang.String cloneName)
Description copied from interface:ResourceClones this resource with a new resource with a different name
-
getLastModified
public long getLastModified()
Description copied from interface:ResourceGet the date the resource was last modified- Specified by:
getLastModifiedin interfaceResource- Returns:
- A
longvalue representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or0Lif the file does not exist or if an I/O error occurs.
-
getContentLength
public long getContentLength()
Description copied from interface:ResourceGet the resource size- Specified by:
getContentLengthin interfaceResource- Returns:
- a
longvalue representing the size of the resource in bytes.
-
exists
public boolean exists()
Description copied from interface:ResourceDetermine if the resource is available. Note that this method only checks for availability, not for actual existence.
-
getURL
public java.net.URL getURL()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isLocal
public boolean isLocal()
Description copied from interface:ResourceIs this resource local to this host, i.e. is it on the file system?
-
openStream
public java.io.InputStream openStream() throws java.io.IOExceptionDescription copied from interface:ResourceOpens a stream on this resource- Specified by:
openStreamin interfaceResource- Returns:
- the opened input stream
- Throws:
java.io.IOException- if something goes wrong
-
getFile
public java.io.File getFile()
- Specified by:
getFilein interfaceLocalizableResource- Returns:
- the local file of this resource.
-
-