public class FileFormatUtil
extends java.lang.Object
To learn more, visit the Detect File Format and Check Format Compatibility documentation article.
| Modifier and Type | Method and Description |
|---|---|
static int |
contentTypeToLoadFormat(java.lang.String contentType)
Converts IANA content type into a load format enumerated value.
|
static int |
contentTypeToSaveFormat(java.lang.String contentType)
Converts IANA content type into a save format enumerated value.
|
static FileFormatInfo |
detectFileFormat(java.io.InputStream stream) |
static FileFormatInfo |
detectFileFormat(java.lang.String fileName)
|
static int |
extensionToSaveFormat(java.lang.String extension)
Converts a file name extension into a
SaveFormat value. |
static java.lang.String |
imageTypeToExtension(int imageType) |
static java.lang.String |
loadFormatToExtension(int loadFormat) |
static int |
loadFormatToSaveFormat(int loadFormat) |
static java.lang.String |
saveFormatToExtension(int saveFormat) |
static int |
saveFormatToLoadFormat(int saveFormat) |
public static FileFormatInfo detectFileFormat(java.lang.String fileName) throws java.lang.Exception
Even if this method detects the document format, it does not guarantee that the specified document is valid. This method only detects the document format by reading data that is sufficient for detection. To fully verify that a document is valid you need to load the document into a Document object.
This method throws FileCorruptedException when the format is recognized, but the detection cannot complete because of corruption.
fileName - The file name.FileFormatInfo object that contains the detected information.java.lang.Exceptionpublic static FileFormatInfo detectFileFormat(java.io.InputStream stream) throws java.lang.Exception
java.lang.Exceptionpublic static int contentTypeToLoadFormat(java.lang.String contentType)
java.lang.IllegalArgumentException - Throws when cannot convert.public static int contentTypeToSaveFormat(java.lang.String contentType)
java.lang.IllegalArgumentException - Throws when cannot convert.public static java.lang.String loadFormatToExtension(int loadFormat)
public static int saveFormatToLoadFormat(int saveFormat)
public static int loadFormatToSaveFormat(int loadFormat)
public static java.lang.String saveFormatToExtension(int saveFormat)
public static int extensionToSaveFormat(java.lang.String extension)
SaveFormat value.extension - The file extension. Can be with or without a leading dot. Case-insensitive.com.aspose.words.net.System.ArgumentNullException - Throws if the parameter is null.public static java.lang.String imageTypeToExtension(int imageType)