net.sourceforge.blogentis.storage
Interface AbstractFileResource

All Known Implementing Classes:
LocalFileResource, SlideFileResource, SlideMemoryFile

public interface AbstractFileResource

Interface for abstract files.

Author:
abas

Method Summary
 boolean exists()
          Check whether the file exists.
 java.io.InputStream getFileAsInputStream()
           
 java.lang.String getFileAsString()
          Get the contents of the file as a string.
 java.util.Date getLastModified()
          Get the last modification time of the file.
 java.lang.String getMimeType()
          Get the stored mime-type of the file or compute it.
 java.lang.String getPath()
          Get the the path that this file has.
 java.lang.String getProperty(java.lang.String propertyName)
          Retrieve a property of the file.
 int getSize()
          Get the size of the file.
 boolean isDirectory()
          Determine if this is a directory.
 boolean isOriginal()
          Check whether this file has not been modified by the user.
 void setProperty(java.lang.String propertyName, java.lang.String propertyContents)
          Set a property on a file.
 

Method Detail

getPath

public java.lang.String getPath()
Get the the path that this file has.

Returns:
the path of the file.

exists

public boolean exists()
Check whether the file exists.

Returns:
true if the file exists and is a file, false otherwise.

getSize

public int getSize()
Get the size of the file.

Returns:
the size of the file in bytes.

getLastModified

public java.util.Date getLastModified()
Get the last modification time of the file.

Returns:
the last modification time of the file.

getMimeType

public java.lang.String getMimeType()
Get the stored mime-type of the file or compute it.

Returns:
the mime-type of the file.

getFileAsInputStream

public java.io.InputStream getFileAsInputStream()
                                         throws java.io.FileNotFoundException
Returns:
@throws FileNotFoundException if exists() is false.
Throws:
java.io.FileNotFoundException

getFileAsString

public java.lang.String getFileAsString()
                                 throws java.io.FileNotFoundException
Get the contents of the file as a string.

Returns:
@throws FileNotFoundException if exists() is false.
Throws:
java.io.FileNotFoundException

isOriginal

public boolean isOriginal()
Check whether this file has not been modified by the user. Only files that return this as false will be backed up.

Returns:
true if the file has not been modified by the user and is the original file distributed.

isDirectory

public boolean isDirectory()
Determine if this is a directory.

Returns:
true if a directory

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
Retrieve a property of the file. Properties are String/String key/value pairs. Implementation is optional.

Parameters:
propertyName - the name of the property to fetch.
Returns:
the property or null of the property does not exist or the file does not support properties.

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyContents)
Set a property on a file. This method can fail silently if the file does not support properties. If the property exists, its contents will be overwritten.

Parameters:
propertyName - the name of the property.
propertyContents - the contents of the property.


Copyright © 2003-2004 SourceForge.net. All Rights Reserved.