org.globus.util
Class GlobusResource

java.lang.Object
  extended by org.globus.util.GlobusResource

public class GlobusResource
extends java.lang.Object

This class provides a way of managing file system resources in a manner similar to the spring framework's Resource class. 3/2/2012


Constructor Summary
GlobusResource(java.lang.String resourcePath)
          Creates a new instance of GlobusResource referencing the specified resourcePath.
 
Method Summary
 boolean exists()
           
 java.io.File getFile()
           
 java.lang.String getFilename()
           
 java.io.InputStream getInputStream()
           
 java.net.URI getURI()
           
 java.net.URL getURL()
           
 boolean isReadable()
           
 long lastModified()
           
 java.lang.String toString()
           
 java.lang.String toURI()
           
 java.lang.String toURL()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlobusResource

public GlobusResource(java.lang.String resourcePath)
Creates a new instance of GlobusResource referencing the specified resourcePath.

Parameters:
resourcePath - The path to the specified resource in the style /directory/directory/fileName.ext
Method Detail

toURI

public java.lang.String toURI()
Returns:
A string representation of the resource's URI

toURL

public java.lang.String toURL()
                       throws java.net.MalformedURLException
Returns:
A string representation of the resource's URL
Throws:
java.net.MalformedURLException

getURI

public java.net.URI getURI()
                    throws java.io.IOException
Returns:
The resource's URI(java.Net.URI)
Throws:
java.io.IOException

getURL

public java.net.URL getURL()
                    throws java.net.MalformedURLException
Returns:
The resource's URL(java.Net.URL)
Throws:
java.net.MalformedURLException

getFile

public java.io.File getFile()
                     throws java.io.IOException
Returns:
A new java.io.File object referencing the resource's resourcePath
Throws:
java.io.IOException

exists

public boolean exists()
Returns:
True if the resource exists, and false if the resource does not exist

lastModified

public long lastModified()
                  throws java.io.IOException
Returns:
The time the resource was last modified
Throws:
java.io.IOException

isReadable

public boolean isReadable()
Returns:
True if the resource is readable, false if the resource is not readable

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Returns:
A new InputStream(java.io.InputStream) of the resource
Throws:
java.io.FileNotFoundException
java.io.IOException

getFilename

public java.lang.String getFilename()
Returns:
The name of the resource in the style fileName.ext

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string representing resourcePath and URI of the resource