Class FileDocument

java.lang.Object
org.apache.rat.api.Document
org.apache.rat.document.FileDocument
All Implemented Interfaces:
Comparable<Document>

public class FileDocument extends Document
Document wrapping a File object.
  • Constructor Details

    • FileDocument

      public FileDocument(DocumentName basedir, File file, DocumentNameMatcher nameMatcher)
      Creates a File document.
      Parameters:
      basedir - the base directory for this document.
      file - the file to wrap.
      nameMatcher - the path matcher to filter files/directories with.
    • FileDocument

      public FileDocument(File file, DocumentNameMatcher nameMatcher)
      Creates a File document where the baseDir is the root directory.
      Parameters:
      file - the file to wrap.
      nameMatcher - the path matcher to filter files/directories with.
  • Method Details

    • isDirectory

      public boolean isDirectory()
      Description copied from class: Document
      Determines if this document is a directory type.
      Specified by:
      isDirectory in class Document
      Returns:
      true if this is a directory.
    • listChildren

      public SortedSet<Document> listChildren()
      Description copied from class: Document
      Gets a sorted set of documents that are children of this document.
      Specified by:
      listChildren in class Document
      Returns:
      A sorted set of child Documents. May be empty.
    • inputStream

      public InputStream inputStream() throws IOException
      Description copied from class: Document
      Streams the document's contents.
      Specified by:
      inputStream in class Document
      Returns:
      a non-null input stream of the document.
      Throws:
      IOException - when stream could not be opened.
    • getFile

      public File getFile()
      Gets the file underlying this document.
      Returns:
      the file underlying this document.