Class FilePdfSource

java.lang.Object
com.inet.pdfc.config.PdfSource
com.inet.pdfc.config.FilePdfSource
All Implemented Interfaces:
Serializable, Comparable<PdfSource>

public class FilePdfSource extends PdfSource
This is a PdfSource which based on a file system object.
See Also:
  • Constructor Details

    • FilePdfSource

      public FilePdfSource(File document)
      Creates the PdfSource for a file system object.
      Parameters:
      document - the actual document file
      Throws:
      IllegalArgumentException - in case pdfFile cannot be accessed or is a directory
      Since:
      3.0
    • FilePdfSource

      public FilePdfSource(File pdfFile, String explicitName)
      Creates the PdfSource for a file system object.
      Parameters:
      pdfFile - the actual PDF document file
      explicitName - the name to be set for this PdfSource, this replaces the name derived from the file
      Throws:
      IllegalArgumentException - in case pdfFile cannot be accessed or is a directory
      Since:
      3.0
    • FilePdfSource

      public FilePdfSource(File pdfFile, String explicitName, boolean setNoMetaPath)
      Creates the PdfSource for a file system object.
      Parameters:
      pdfFile - the actual PDF document file
      explicitName - the name to be set for this PdfSource, this replaces the name derived from the file
      setNoMetaPath - true for removing path information, for other case false
      Throws:
      IllegalArgumentException - in case pdfFile cannot be accessed or is a directory
      Since:
      3.0
  • Method Details

    • getLastModified

      public long getLastModified()
      Returns the time of the last modification to the document. It's only used for report generation an has no impact on the comparison.
      Overrides:
      getLastModified in class PdfSource
      Returns:
      the last modified timestamp of the document; interpreted as milliseconds since the beginning of 1970
    • getSize

      public long getSize()
      Returns the size of the raw data in bytes
      Overrides:
      getSize in class PdfSource
      Returns:
      the size of the raw data in bytes
    • getPath

      public String getPath()
      Get the path of this document, if one exist. If no existing path, it give null back.
      Overrides:
      getPath in class PdfSource
      Returns:
      return the path of the document or null if no path exist
    • getContent

      public com.inet.persistence.RandomAccessRead getContent() throws IOException
      Returns the readable content of this document source
      Specified by:
      getContent in class PdfSource
      Returns:
      the readable content of this document source
      Throws:
      IOException - thrown in case the source data cannot be accessed or does not exist