Class FSDirectory

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, IDirectory, IFSDirectory
    Direct Known Subclasses:
    FSShallowDirectory

    public class FSDirectory
    extends java.lang.Object
    implements IFSDirectory
    IDirectory implementation that uses a file system's directory as the concrete repository.
    Since:
    4.0.10
    Version:
    $Revision: 8804 $ $Date: 2008-01-22 16:41:47 -0200 (Tue, 22 Jan 2008) $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.File rootFile  
    • Constructor Summary

      Constructors 
      Constructor Description
      FSDirectory​(java.io.File root)  
      FSDirectory​(java.lang.String rootPath)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void delete()
      Delete the repository.
      boolean exists​(java.lang.String filePath)
      Check the existence of a file.
      java.lang.String getDescription()
      Generate a general description of the directory, used mainly to compose exception messages.
      java.lang.String getDirectoryPath()  
      java.io.InputStream getInputStream​(java.lang.String filePath)
      Get an InputStream to a repository file.
      java.io.OutputStream getOutputStream​(java.lang.String filePath)
      Get an OutputStream to a repository file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rootFile

        protected java.io.File rootFile
    • Constructor Detail

      • FSDirectory

        public FSDirectory​(java.lang.String rootPath)
      • FSDirectory

        public FSDirectory​(java.io.File root)
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream​(java.lang.String filePath)
                                           throws java.io.FileNotFoundException,
                                                  java.io.IOException
        Description copied from interface: IDirectory
        Get an InputStream to a repository file.
        Specified by:
        getInputStream in interface IDirectory
        Parameters:
        filePath - path to the file.
        Returns:
        InputStream to file found in specified filePath.
        Throws:
        java.io.FileNotFoundException - if no file was found in specified filePath.
        java.io.IOException - if an I/O error occurs.
      • getOutputStream

        public java.io.OutputStream getOutputStream​(java.lang.String filePath)
                                             throws java.io.IOException
        Description copied from interface: IDirectory
        Get an OutputStream to a repository file.
        Specified by:
        getOutputStream in interface IDirectory
        Parameters:
        filePath - path to the file.
        Returns:
        OutputStream to the new file
        Throws:
        java.io.IOException - if an I/O error occurs.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • exists

        public boolean exists​(java.lang.String filePath)
                       throws java.io.IOException
        Description copied from interface: IDirectory
        Check the existence of a file.
        Specified by:
        exists in interface IDirectory
        Parameters:
        filePath - path to the file to be checked.
        Returns:
        true, if the specified file exists.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: IDirectory
        Generate a general description of the directory, used mainly to compose exception messages.
        Specified by:
        getDescription in interface IDirectory
        Returns:
        directory description.
      • delete

        public void delete()
                    throws java.io.IOException
        Description copied from interface: IDirectory
        Delete the repository.
        Specified by:
        delete in interface IDirectory
        Throws:
        java.io.IOException - if an I/O error occurs.