FileFormatUtil
Inheritance: java.lang.Object
public class FileFormatUtil
Provides utility methods for working with file formats, such as detecting file format or converting file extensions to/from file format enums.
To learn more, visit the Detect File Format and Check Format Compatibility documentation article.
Methods
Method | Description |
---|---|
contentTypeToLoadFormat(String contentType) | Converts IANA content type into a load format enumerated value. |
contentTypeToSaveFormat(String contentType) | Converts IANA content type into a save format enumerated value. |
detectFileFormat(InputStream stream) | |
detectFileFormat(String fileName) | Detects and returns the information about a format of a document. |
equals(Object arg0) | |
extensionToSaveFormat(String extension) | Converts a file name extension into a SaveFormat value. |
getClass() | |
hashCode() | |
imageTypeToExtension(int imageType) | |
loadFormatToExtension(int loadFormat) | |
loadFormatToSaveFormat(int loadFormat) | |
notify() | |
notifyAll() | |
saveFormatToExtension(int saveFormat) | |
saveFormatToLoadFormat(int saveFormat) | |
toString() | |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
contentTypeToLoadFormat(String contentType)
public static int contentTypeToLoadFormat(String contentType)
Converts IANA content type into a load format enumerated value.
Parameters:
Parameter | Type | Description |
---|---|---|
contentType | java.lang.String |
Returns: int
contentTypeToSaveFormat(String contentType)
public static int contentTypeToSaveFormat(String contentType)
Converts IANA content type into a save format enumerated value.
Parameters:
Parameter | Type | Description |
---|---|---|
contentType | java.lang.String |
Returns: int
detectFileFormat(InputStream stream)
public static FileFormatInfo detectFileFormat(InputStream stream)
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream |
Returns: FileFormatInfo
detectFileFormat(String fileName)
public static FileFormatInfo detectFileFormat(String fileName)
Detects and returns the information about a format of a document. Detects and returns the information about a format of a document stored in a disk file.
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.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The file name. |
Returns: FileFormatInfo - A FileFormatInfo object that contains the detected information.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
extensionToSaveFormat(String extension)
public static int extensionToSaveFormat(String extension)
Converts a file name extension into a SaveFormat value.
Parameters:
Parameter | Type | Description |
---|---|---|
extension | java.lang.String | The file extension. Can be with or without a leading dot. Case-insensitive. |
If the extension cannot be recognized, returns SaveFormat.UNKNOWN. |
Returns: int
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class>
hashCode()
public native int hashCode()
Returns: int
imageTypeToExtension(int imageType)
public static String imageTypeToExtension(int imageType)
Parameters:
Parameter | Type | Description |
---|---|---|
imageType | int |
Returns: java.lang.String
loadFormatToExtension(int loadFormat)
public static String loadFormatToExtension(int loadFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
loadFormat | int |
Returns: java.lang.String
loadFormatToSaveFormat(int loadFormat)
public static int loadFormatToSaveFormat(int loadFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
loadFormat | int |
Returns: int
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
saveFormatToExtension(int saveFormat)
public static String saveFormatToExtension(int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
saveFormat | int |
Returns: java.lang.String
saveFormatToLoadFormat(int saveFormat)
public static int saveFormatToLoadFormat(int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
saveFormat | int |
Returns: int
toString()
public String toString()
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |