Package de.xima.fc.common.file
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 ofIFileData
.- Since:
- 8.4.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
content()
Required.String
contentType()
Required.String
fileName()
Required.static IFileData
ofBinaryContent(byte[] content, String fileName, String contentType)
Creates a new POJO for a file with binary content.static IFileData
ofFile(Path file, String fileName, String mimeType)
Creates a new POJO for file data.
-
-
-
Method Detail
-
content
public byte[] content()
Description copied from interface:IFileData
Required. The binary content of the file.
-
contentType
public String contentType()
Description copied from interface:IFileData
Required. The MIME type of the file.- Specified by:
contentType
in interfaceIFileData
- Returns:
- The MIME type of the file.
-
fileName
public String fileName()
Description copied from interface:IFileData
Required. 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.
-
-