org.helma.repository
Class FileResource

java.lang.Object
  extended by org.helma.repository.FileResource
All Implemented Interfaces:
Resource

public class FileResource
extends java.lang.Object
implements Resource


Constructor Summary
  FileResource(java.io.File file)
           
protected FileResource(java.io.File file, Repository repository)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 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
 int hashCode()
           
 long lastModified()
          Returns the date the resource was last modified
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileResource

public FileResource(java.io.File file)

FileResource

protected FileResource(java.io.File file,
                       Repository repository)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Resource
Returns the name of the resource; does not include the name of the repository the resource was fetched from

Specified by:
getName in interface Resource
Returns:
name of the resource

getShortName

public java.lang.String getShortName()
Description copied from interface: Resource
Returns the short name of the resource which is its name exclusive file ending if it exists

Specified by:
getShortName in interface Resource
Returns:
short name of the resource

getBaseName

public java.lang.String getBaseName()
Description copied from interface: Resource
Returns the short name of the resource with the file extension (everything following the last dot character) cut off.

Specified by:
getBaseName in interface Resource
Returns:
the file name without the file extension

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: Resource
Returns an input stream to the content of the resource

Specified by:
getInputStream in interface Resource
Returns:
content input stream
Throws:
java.io.IOException - if a I/O related error occurs

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
Description copied from interface: Resource
Returns a reader for the resource

Specified by:
getReader in interface Resource
Returns:
the reader
Throws:
java.io.IOException - if a I/O related error occurs

getUrl

public java.net.URL getUrl()
Description copied from interface: Resource
Returns an url to the resource if the repository of this resource is able to provide urls

Specified by:
getUrl in interface Resource
Returns:
url to the resource

lastModified

public long lastModified()
Description copied from interface: Resource
Returns the date the resource was last modified

Specified by:
lastModified in interface Resource
Returns:
last modified date

getContent

public java.lang.String getContent(java.lang.String encoding)
                            throws java.io.IOException
Description copied from interface: Resource
Returns the content of the resource in a given encoding

Specified by:
getContent in interface Resource
Returns:
content
Throws:
java.io.IOException

getContent

public java.lang.String getContent()
                            throws java.io.IOException
Description copied from interface: Resource
Returns the content of the resource

Specified by:
getContent in interface Resource
Returns:
content
Throws:
java.io.IOException

getLength

public long getLength()
Description copied from interface: Resource
Returns the lengh of the resource's content

Specified by:
getLength in interface Resource
Returns:
content length

exists

public boolean exists()
Description copied from interface: Resource
Checks wether this resource actually (still) exists

Specified by:
exists in interface Resource
Returns:
true if the resource exists

getRepository

public Repository getRepository()
Description copied from interface: Resource
Returns the repository the resource does belong to

Specified by:
getRepository in interface Resource
Returns:
upper repository

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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