Package com.priint.pubserver.util
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
ConstructorsConstructorDescriptionFileDataHandler(jakarta.activation.FileDataSource ds, File tmpFile) constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanclean()longsize()method to get the size of the temporary filestatic FileDataHandlertoFileDataHandler(jakarta.activation.DataHandler source) Method to convert a DataHandler to a FileDataHandlerMethods inherited from class jakarta.activation.DataHandler
getAllCommands, getBean, getCommand, getContent, getContentType, getDataSource, getInputStream, getName, getOutputStream, getPreferredCommands, getTransferData, getTransferDataFlavors, isDataFlavorSupported, setCommandMap, setDataContentHandlerFactory, writeTo
-
Constructor Details
-
FileDataHandler
constructor- Parameters:
ds- data sourcetmpFile- temporary file
-
-
Method Details
-
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.
-