org.sapia.resource
Class UrlResource

java.lang.Object
  extended by org.sapia.resource.UrlResource
All Implemented Interfaces:
Resource, URLCapable

public class UrlResource
extends java.lang.Object
implements Resource, URLCapable

Implements a Resource over a URL

Author:
Yanick Duchesne
See Also:
URL

Constructor Summary
UrlResource(java.net.URL url)
           
 
Method Summary
 java.io.InputStream getInputStream()
           
 Resource getRelative(java.lang.String uri)
           
 java.lang.String getURI()
           
 java.net.URL getURL()
           
 long lastModified()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UrlResource

public UrlResource(java.net.URL url)
Method Detail

lastModified

public long lastModified()
Specified by:
lastModified in interface Resource
Returns:
the time, in millis, at which this resource was last modified.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Specified by:
getInputStream in interface Resource
Returns:
the InputStream corresponding to this resource.
Throws:
java.io.IOException

getURI

public java.lang.String getURI()
Specified by:
getURI in interface Resource
Returns:
the URI that this resource corresponds to.

getURL

public java.net.URL getURL()
                    throws java.io.IOException
Specified by:
getURL in interface URLCapable
Returns:
the URL corresponding to this instance.
Throws:
java.io.IOException - if an error occurs.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRelative

public Resource getRelative(java.lang.String uri)
                     throws java.io.IOException
Specified by:
getRelative in interface Resource
Parameters:
uri - a URI.
Returns:
the Resource corresponding to the given relative URI.
Throws:
java.io.IOException


Copyright © 2011 Sapia OSS. All Rights Reserved.