public final class FileUtils
extends java.lang.Object
Utility class for managing files.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BMP_MEDIA_TYPE
Attribute that represents the BMP media type.
|
static java.lang.String |
DATA_FILE_EXTENSION
Attribute that represents the extension used for the Binary Files.
|
static java.lang.String |
GIF_MEDIA_TYPE
Attribute that represents the GIF media type.
|
static java.lang.String |
HTML_MEDIA_TYPE
Attribute that represents the HTML media type.
|
static java.lang.String |
JPEG_MEDIA_TYPE
Attribute that represents the JPEG media type.
|
static java.lang.String |
MSOFFICE_DOC_MEDIA_TYPE
Attribute that represents the microsoft word media type.
|
static java.lang.String |
MSOFFICE_DOCX_MEDIA_TYPE
Attribute that represents the microsoft word media type (in open xml format).
|
static java.lang.String |
MSOFFICE_PPT_MEDIA_TYPE
Attribute that represents the microsoft powerpoint media type.
|
static java.lang.String |
MSOFFICE_PPTX_MEDIA_TYPE
Attribute that represents the microsoft powerpoint media type (in open xml format).
|
static java.lang.String |
MSOFFICE_XLS_MEDIA_TYPE
Attribute that represents the microsoft excel media type.
|
static java.lang.String |
MSOFFICE_XLSX_MEDIA_TYPE
Attribute that represents the microsoft excel media type (in open xml format).
|
static java.lang.String |
ODC_MEDIA_TYPE
Attribute that represents the ODC media type.
|
static java.lang.String |
ODG_MEDIA_TYPE
Attribute that represents the ODG media type.
|
static java.lang.String |
ODP_MEDIA_TYPE
Attribute that represents the ODP media type.
|
static java.lang.String |
ODS_MEDIA_TYPE
Attribute that represents the ODS media type.
|
static java.lang.String |
ODT_MEDIA_TYPE
Attribute that represents the ODT media type.
|
static java.lang.String |
PDF_MEDIA_TYPE
Attribute that represents the PDF media type.
|
static java.lang.String |
PNG_MEDIA_TYPE
Attribute that represents the PNG media type.
|
static java.lang.String |
RTF_MEDIA_TYPE
Attribute that represents the RTF media type.
|
static java.lang.String |
TIFF_MEDIA_TYPE
Attribute that represents the PNG media type.
|
static java.lang.String |
TXT_MEDIA_TYPE
Attribute that represents the text plain media type.
|
static java.lang.String |
XML_MEDIA_TYPE
Attribute that represents the XML media type.
|
static java.lang.String |
XSLT_MEDIA_TYPE
Attribute that represents the XSLT media type.
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getFile(java.lang.String templatePath)
Method that returns the array of bytes of supplied file.
|
static java.lang.String |
getFileExtension(byte[] file)
Gets the file extension.
|
static java.lang.String |
getFileExtension(java.lang.String mimeType)
Gets the file extension.
|
static java.lang.String |
getMediaType(byte[] document)
Detects the media type of the given document.
|
static boolean |
isImage(java.lang.String mimeType)
Checks if the supplied MimeType is a supported image MimeType.
|
static boolean |
isTextFile(java.lang.String mimeType)
Checks if the supplied MimeType is a supported text plain file or XML file.
|
static boolean |
isXML(byte[] file)
Checks if the supplied file is a valid XML.
|
static byte[] |
toByteArray(java.sql.Blob fromBlob)
Method that obtains a bytes array from a
Blob object. |
public static final java.lang.String ODT_MEDIA_TYPE
public static final java.lang.String ODG_MEDIA_TYPE
public static final java.lang.String ODS_MEDIA_TYPE
public static final java.lang.String ODP_MEDIA_TYPE
public static final java.lang.String ODC_MEDIA_TYPE
public static final java.lang.String BMP_MEDIA_TYPE
public static final java.lang.String GIF_MEDIA_TYPE
public static final java.lang.String JPEG_MEDIA_TYPE
public static final java.lang.String PNG_MEDIA_TYPE
public static final java.lang.String TIFF_MEDIA_TYPE
public static final java.lang.String PDF_MEDIA_TYPE
public static final java.lang.String MSOFFICE_DOC_MEDIA_TYPE
public static final java.lang.String MSOFFICE_DOCX_MEDIA_TYPE
public static final java.lang.String MSOFFICE_PPT_MEDIA_TYPE
public static final java.lang.String MSOFFICE_PPTX_MEDIA_TYPE
public static final java.lang.String MSOFFICE_XLS_MEDIA_TYPE
public static final java.lang.String MSOFFICE_XLSX_MEDIA_TYPE
public static final java.lang.String TXT_MEDIA_TYPE
public static final java.lang.String RTF_MEDIA_TYPE
public static final java.lang.String XML_MEDIA_TYPE
public static final java.lang.String XSLT_MEDIA_TYPE
public static final java.lang.String HTML_MEDIA_TYPE
public static final java.lang.String DATA_FILE_EXTENSION
public static java.lang.String getFileExtension(byte[] file)
throws UtilsException
file - File.UtilsException - If an error occurs.public static java.lang.String getFileExtension(java.lang.String mimeType)
throws UtilsException
mimeType - MimeType.UtilsException - If an error occurs.public static boolean isXML(byte[] file)
throws UtilsException
file - File to check.UtilsException - If an error occurs while processing the file.public static byte[] toByteArray(java.sql.Blob fromBlob)
throws UtilsException
Blob object.fromBlob - Parameter that represents the Blob object.Blob object.UtilsException - If an error occurs.public static byte[] getFile(java.lang.String templatePath)
throws UtilsException
templatePath - Path of file to get.UtilsException - If an error occurs while the system is reading the file.public static java.lang.String getMediaType(byte[] document)
throws UtilsException
document - The document stream.UtilsExceptionpublic static boolean isImage(java.lang.String mimeType)
mimeType - MimeType.public static boolean isTextFile(java.lang.String mimeType)
mimeType - MimeType.