net.sourceforge.ganttproject.document
Class FileDocument

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

public class FileDocument
extends AbstractDocument

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 getPath()
          Gets the path to the document.
 boolean isValidForMRU()
          Checks, wether the document should appear in the MRU (list of most recently used files).
 
Methods inherited from class net.sourceforge.ganttproject.document.AbstractDocument
acquireLock, equals, getLastError, getPassword, getURLPath, getUsername, releaseLock
 
Methods inherited from class java.lang.Object
clone, 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).

Returns:
the description of the document

canRead

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

Returns:
readability

canWrite

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

Returns:
writability

isValidForMRU

public boolean isValidForMRU()
Description copied from interface: Document
Checks, wether the document should appear in the MRU (list of most recently used files).

Returns:
validity for MRU

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.

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.

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.

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
Overrides:
getFilePath in class AbstractDocument
Returns:
the path, if the document is a local file; null, otherwise.


Copyright © 2002 Alexandre THOMAS.