org.helma.repository
Interface Resource

All Known Implementing Classes:
FileResource, ZipResource

public interface Resource

Resource represents a pointer to some kind of information (code, skin, ...) from which the content can be fetched


Method Summary
 boolean exists()
          Checks wether this resource actually (still) exists
 java.lang.String getBaseName()
          Returns the short name of the resource with the file extension (everything following the last dot character) cut off.
 java.lang.String getContent()
          Returns the content of the resource
 java.lang.String getContent(java.lang.String encoding)
          Returns the content of the resource in a given encoding
 java.io.InputStream getInputStream()
          Returns an input stream to the content of the resource
 long getLength()
          Returns the lengh of the resource's content
 java.lang.String getName()
          Returns the name of the resource; does not include the name of the repository the resource was fetched from
 java.io.Reader getReader()
          Returns a reader for the resource
 Repository getRepository()
          Returns the repository the resource does belong to
 java.lang.String getShortName()
          Returns the short name of the resource which is its name exclusive file ending if it exists
 java.net.URL getUrl()
          Returns an url to the resource if the repository of this resource is able to provide urls
 long lastModified()
          Returns the date the resource was last modified
 

Method Detail

lastModified

long lastModified()
Returns the date the resource was last modified

Returns:
last modified date

exists

boolean exists()
Checks wether this resource actually (still) exists

Returns:
true if the resource exists

getLength

long getLength()
               throws java.io.IOException
Returns the lengh of the resource's content

Returns:
content length
Throws:
java.io.IOException

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an input stream to the content of the resource

Returns:
content input stream
Throws:
java.io.IOException - if a I/O related error occurs

getReader

java.io.Reader getReader()
                         throws java.io.IOException
Returns a reader for the resource

Returns:
the reader
Throws:
java.io.IOException - if a I/O related error occurs

getContent

java.lang.String getContent(java.lang.String encoding)
                            throws java.io.IOException
Returns the content of the resource in a given encoding

Parameters:
encoding -
Returns:
content
Throws:
java.io.IOException

getContent

java.lang.String getContent()
                            throws java.io.IOException
Returns the content of the resource

Returns:
content
Throws:
java.io.IOException

getName

java.lang.String getName()
Returns the name of the resource; does not include the name of the repository the resource was fetched from

Returns:
name of the resource

getShortName

java.lang.String getShortName()
Returns the short name of the resource which is its name exclusive file ending if it exists

Returns:
short name of the resource

getBaseName

java.lang.String getBaseName()
Returns the short name of the resource with the file extension (everything following the last dot character) cut off.

Returns:
the file name without the file extension

getUrl

java.net.URL getUrl()
                    throws java.lang.UnsupportedOperationException
Returns an url to the resource if the repository of this resource is able to provide urls

Returns:
url to the resource
Throws:
java.lang.UnsupportedOperationException

getRepository

Repository getRepository()
Returns the repository the resource does belong to

Returns:
upper repository