org.sapia.resource
Class FileResource

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

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

Implements a Resource over a File

Author:
Yanick Duchesne
See Also:
File

Constructor Summary
FileResource(java.io.File f)
           
 
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

FileResource

public FileResource(java.io.File f)
Method Detail

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.

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

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

lastModified

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

toString

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


Copyright © 2011 Sapia OSS. All Rights Reserved.