Record Class PdfFile

java.lang.Object
java.lang.Record
formflow.library.pdf.PdfFile

public record PdfFile(String path, String name) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    PdfFile(String path, String name)
    Creates an instance of a PdfFile record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static PdfFile
    copyToTempFile(String pathToResource)
    This static function will take in a path to a template file and create a PdfFile object to return to the caller.
    void
    Deletes the underlying temporary file from the file system.
    final boolean
    Indicates whether some other object is "equal to" this one.
    byte[]
    Returns a byte array containing all the contents of the PDF file.
    void
    Does all the tasks necessary to finalize the PDF file.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    Returns the value of the path record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PdfFile

      public PdfFile(String path, String name)
      Creates an instance of a PdfFile record class.
      Parameters:
      path - the value for the path record component
      name - the value for the name record component
  • Method Details

    • copyToTempFile

      public static PdfFile copyToTempFile(String pathToResource)
      This static function will take in a path to a template file and create a PdfFile object to return to the caller. It will create temp space on the filesystem that the PDF file is read into.
      Parameters:
      pathToResource - String path to PDF resource to read in
      Returns:
      PdfFile object representing the PDF indicated.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • fileBytes

      public byte[] fileBytes() throws IOException
      Returns a byte array containing all the contents of the PDF file.
      Returns:
      Byte array of file contents
      Throws:
      IOException - Thrown if the file cannot be read in.
    • finalizeForSending

      public void finalizeForSending() throws IOException
      Does all the tasks necessary to finalize the PDF file. It will flatten the PDF file.
      Throws:
      IOException - Thrown if the file cannot be read in.
    • deleteFile

      public void deleteFile() throws IOException
      Deletes the underlying temporary file from the file system.
      Throws:
      IOException - Thrown if the file cannot be worked with.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component