Package formflow.library.pdf
Record Class PdfFile
java.lang.Object
java.lang.Record
formflow.library.pdf.PdfFile
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfFilecopyToTempFile(String pathToResource) This static function will take in a path to a template file and create a PdfFile object to return to the caller.voidDeletes the underlying temporary file from the file system.final booleanIndicates whether some other object is "equal to" this one.byte[]Returns a byte array containing all the contents of the PDF file.voidDoes all the tasks necessary to finalize the PDF file.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.path()Returns the value of thepathrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
PdfFile
Creates an instance of aPdfFilerecord class.- Parameters:
path- the value for thepathrecord componentname- the value for thenamerecord component
-
-
Method Details
-
copyToTempFile
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
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. -
fileBytes
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
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
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. -
equals
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 withObjects::equals(Object,Object). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-