Class FileDataHandler

java.lang.Object
jakarta.activation.DataHandler
com.priint.pubserver.util.FileDataHandler

public class FileDataHandler extends jakarta.activation.DataHandler
Handler for the file data
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileDataHandler(jakarta.activation.FileDataSource ds, File tmpFile)
    constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
     
    long
    method to get the size of the temporary file
    toFileDataHandler(jakarta.activation.DataHandler source)
    Method to convert a DataHandler to a FileDataHandler

    Methods inherited from class jakarta.activation.DataHandler

    getAllCommands, getBean, getCommand, getContent, getContentType, getDataSource, getInputStream, getName, getOutputStream, getPreferredCommands, getTransferData, getTransferDataFlavors, isDataFlavorSupported, setCommandMap, setDataContentHandlerFactory, writeTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileDataHandler

      public FileDataHandler(jakarta.activation.FileDataSource ds, File tmpFile)
      constructor
      Parameters:
      ds - data source
      tmpFile - temporary file
  • Method Details

    • getTmpFile

      public File getTmpFile()
      Returns:
      temporary file
    • toFileDataHandler

      public static FileDataHandler toFileDataHandler(jakarta.activation.DataHandler source) throws IOException
      Method to convert a DataHandler to a FileDataHandler
      Parameters:
      source - to be converted to FileDataHandler
      Returns:
      FileDataHandler
      Throws:
      IOException
    • clean

      public boolean clean()
      Returns:
      true if the file has been successfully deleted. False otherwise
    • size

      public long size()
      method to get the size of the temporary file
      Returns:
      size of the temporary file. If the file is null or does not exist 0 will be returned.