Class FileData

java.lang.Object
de.xima.fc.common.file.FileData
All Implemented Interfaces:
IFileData, Serializable

public final class FileData extends Object implements IFileData
Default POJO implementation of IFileData.
Since:
8.4.0
See Also:
  • Method Details

    • content

      public byte[] content()
      Description copied from interface: IFileData
      Required. The binary content of the file.
      Specified by:
      content in interface IFileData
      Returns:
      The content of the file.
    • contentType

      public String contentType()
      Description copied from interface: IFileData
      Required. The MIME type of the file.
      Specified by:
      contentType in interface IFileData
      Returns:
      The MIME type of the file.
    • fileName

      public String fileName()
      Description copied from interface: IFileData
      Required. The name of the file.
      Specified by:
      fileName in interface IFileData
      Returns:
      The name of the file
    • ofBinaryContent

      public static IFileData ofBinaryContent(byte[] content, String fileName, String contentType)
      Creates a new POJO for a file with binary content.
      Parameters:
      content - The binary content of the file. null is treated as an empty array.
      fileName - The name of the file.
      contentType - The MIME type of the file.
      Returns:
      A new POJO for the data of a file.
    • ofFile

      public static IFileData ofFile(Path file, String fileName, String mimeType) throws IOException
      Creates a new POJO for file data.
      Parameters:
      file - The file. null is treated as an empty file.
      fileName - The name of the file.
      mimeType - The MIME type of the file.
      Returns:
      A new POJO for data of a file.
      Throws:
      IOException - When the data of the given file could not be read.