net.sourceforge.ganttproject.document
Class FileDocument

java.lang.Object
  |
  +--net.sourceforge.ganttproject.document.FileDocument
All Implemented Interfaces:
Document

public class FileDocument
extends java.lang.Object
implements Document

This class implements the interface Document for file access on local file systems.

Author:
Michael Haeusler (michael at akatose.de)

Constructor Summary
FileDocument(java.io.File file)
           
 
Method Summary
 boolean canRead()
          Checks, wether the document is readable.
 boolean canWrite()
          Checks, wether the document is writable.
 java.lang.String getDescription()
          Gets the description of the document (can be displayed in the application's titlebar).
 java.lang.String getFilePath()
          Gets the path to the document, if it is a file on a local file system (can be used to initialize a JFileChooser).
 java.io.InputStream getInputStream()
          Gets an InputStream, that allows to read from the document.
 java.io.OutputStream getOutputStream()
          Gets an OutputStream, that allows to write to the document.
 java.lang.String getPassword()
          Gets the password used to authenticate to the storage container
 java.lang.String getPath()
          Gets the path to the document.
 java.lang.String getURLPath()
          Gets the path to the document, if it is a file on a server (can be used to initialize an UrlChooser).
 java.lang.String getUsername()
          Gets the username used to authenticate to the storage container
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDocument

public FileDocument(java.io.File file)
Method Detail

getDescription

public java.lang.String getDescription()
Description copied from interface: Document
Gets the description of the document (can be displayed in the application's titlebar).

Specified by:
getDescription in interface Document
Returns:
the description of the document

canRead

public boolean canRead()
Description copied from interface: Document
Checks, wether the document is readable.

Specified by:
canRead in interface Document
Returns:
readability

canWrite

public boolean canWrite()
Description copied from interface: Document
Checks, wether the document is writable.

Specified by:
canWrite in interface Document
Returns:
writability

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException
Description copied from interface: Document
Gets an InputStream, that allows to read from the document.

Specified by:
getInputStream in interface Document
Returns:
InputStream to read from
java.io.FileNotFoundException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.FileNotFoundException
Description copied from interface: Document
Gets an OutputStream, that allows to write to the document.

Specified by:
getOutputStream in interface Document
Returns:
OutputStream to write to
java.io.FileNotFoundException

getPath

public java.lang.String getPath()
Description copied from interface: Document
Gets the path to the document.

Specified by:
getPath in interface Document
Returns:
the path to the document

getFilePath

public java.lang.String getFilePath()
Description copied from interface: Document
Gets the path to the document, if it is a file on a local file system (can be used to initialize a JFileChooser).

Specified by:
getFilePath in interface Document
Returns:
the path, if the document is a local file; null, otherwise.

getURLPath

public java.lang.String getURLPath()
Description copied from interface: Document
Gets the path to the document, if it is a file on a server (can be used to initialize an UrlChooser).

Specified by:
getURLPath in interface Document
Returns:
the path, if the document is a server file; null, otherwise.

getUsername

public java.lang.String getUsername()
Description copied from interface: Document
Gets the username used to authenticate to the storage container

Specified by:
getUsername in interface Document
Returns:
username

getPassword

public java.lang.String getPassword()
Description copied from interface: Document
Gets the password used to authenticate to the storage container

Specified by:
getPassword in interface Document
Returns:
username


${copyright}