Class TempFileResourcesHandler

java.lang.Object
eu.europa.esig.dss.signature.resources.AbstractResourcesHandler
eu.europa.esig.dss.signature.resources.TempFileResourcesHandler
All Implemented Interfaces:
DSSResourcesHandler, Closeable, AutoCloseable

public class TempFileResourcesHandler extends AbstractResourcesHandler
This resources factory stores temporary documents to a unique file within filesystem. Removes temporary files on exit, unless they have been used within a eu.europa.esig.dss.model.FileDocument.
  • Constructor Details

    • TempFileResourcesHandler

      public TempFileResourcesHandler(String fileNamePrefix, String fileNameSuffix, File tempFileDirectory)
      Default constructor
      Parameters:
      fileNamePrefix - String filename prefix string
      fileNameSuffix - String filename suffix string
      tempFileDirectory - File representing a directory to store temporary documents in
  • Method Details

    • buildOutputStream

      protected OutputStream buildOutputStream() throws IOException
      Description copied from class: AbstractResourcesHandler
      Builds OutputStream
      Specified by:
      buildOutputStream in class AbstractResourcesHandler
      Returns:
      OutputStream
      Throws:
      IOException - if an error occurs while building OutputStream
    • writeToDSSDocument

      public eu.europa.esig.dss.model.DSSDocument writeToDSSDocument()
      Description copied from interface: DSSResourcesHandler
      This method creates a new DSSDocument representing a signed document, based on the created OutputStream.
      Returns:
      DSSDocument
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class AbstractResourcesHandler
      Throws:
      IOException
    • forceDelete

      public void forceDelete()
      This method is used to delete the temporary File forcibly, even with a flag toBeDeleted set to false. Method should be called responsively and the temp file should be preserved when needed (e.g. output of signDocument() method).