FileFormatUtil
Inheritance: java.lang.Object
public class FileFormatUtil
Provides utility methods for converting file format enums to strings or file extensions and back.
Methods
Method | Description |
---|---|
detectFileFormat(InputStream stream) | Detects and returns the information about a format of an excel stored in a stream. |
detectFileFormat(InputStream stream, String password) | Detects and returns the information about a format of an excel stored in a stream. |
detectFileFormat(String filePath) | Detects and returns the information about a format of an excel stored in a file. |
detectFileFormat(String filePath, String password) | Detects and returns the information about a format of an excel stored in a file. |
equals(Object arg0) | |
extensionToSaveFormat(String extension) | Converts a file name extension into a SaveFormat value. |
fileFormatToSaveFormat(int format) | Converting file format to save format. |
getClass() | |
hashCode() | |
isTemplateFormat(String extension) | Returns true if the extension is .xlt, .xltX, .xltm,.ots. |
loadFormatToExtension(int loadFormat) | Converts a load format enumerated value into a file extension. |
loadFormatToSaveFormat(int loadFormat) | Converts a LoadFormat value to a SaveFormat value if possible. |
notify() | |
notifyAll() | |
saveFormatToExtension(int format) | Converts a save format enumerated value into a file extension. |
saveFormatToLoadFormat(int saveFormat) | Converts a SaveFormat value to a LoadFormat value if possible. |
toString() | |
verifyPassword(InputStream stream, String password) | Detects and returns the information about a format of an excel stored in a stream. |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
detectFileFormat(InputStream stream)
public static FileFormatInfo detectFileFormat(InputStream stream)
Detects and returns the information about a format of an excel stored in a stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream |
Returns: FileFormatInfo - A FileFormatInfo object that contains the detected information.
detectFileFormat(InputStream stream, String password)
public static FileFormatInfo detectFileFormat(InputStream stream, String password)
Detects and returns the information about a format of an excel stored in a stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | |
password | java.lang.String | The password for encrypted ooxml files. |
Returns: FileFormatInfo - A FileFormatInfo object that contains the detected information.
detectFileFormat(String filePath)
public static FileFormatInfo detectFileFormat(String filePath)
Detects and returns the information about a format of an excel stored in a file.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
Returns: FileFormatInfo - A FileFormatInfo object that contains the detected information.
detectFileFormat(String filePath, String password)
public static FileFormatInfo detectFileFormat(String filePath, String password)
Detects and returns the information about a format of an excel stored in a file.
Parameters:
Parameter | Type | Description |
---|---|---|
filePath | java.lang.String | The file path. |
password | java.lang.String | The password for encrypted ooxml files. |
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.
Remarks
If the extension cannot be recognized, returns SaveFormat.UNKNOWN.
Parameters:
Parameter | Type | Description |
---|---|---|
extension | java.lang.String | The file extension. Can be with or without a leading dot. Case-insensitive. |
Returns: int - SaveFormat.
fileFormatToSaveFormat(int format)
public static int fileFormatToSaveFormat(int format)
Converting file format to save format.
Parameters:
Parameter | Type | Description |
---|---|---|
format | int | FileFormatType. The file format type. |
Returns: int - SaveFormat.
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
hashCode()
public native int hashCode()
Returns: int
isTemplateFormat(String extension)
public static boolean isTemplateFormat(String extension)
Returns true if the extension is .xlt, .xltX, .xltm,.ots.
Parameters:
Parameter | Type | Description |
---|---|---|
extension | java.lang.String |
Returns: boolean -
loadFormatToExtension(int loadFormat)
public static String loadFormatToExtension(int loadFormat)
Converts a load format enumerated value into a file extension.
Remarks
If it can not be converted, returns null.
Parameters:
Parameter | Type | Description |
---|---|---|
loadFormat | int | LoadFormat. The loaded file format. |
Returns: java.lang.String - The returned extension is a lower-case string with a leading dot.
loadFormatToSaveFormat(int loadFormat)
public static int loadFormatToSaveFormat(int loadFormat)
Converts a LoadFormat value to a SaveFormat value if possible.
Parameters:
Parameter | Type | Description |
---|---|---|
loadFormat | int | LoadFormat. The load format. |
Returns: int - SaveFormat. The save format.
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
saveFormatToExtension(int format)
public static String saveFormatToExtension(int format)
Converts a save format enumerated value into a file extension.
Parameters:
Parameter | Type | Description |
---|---|---|
format | int | SaveFormat. The save format. |
Returns: java.lang.String - The returned extension is a lower-case string with a leading dot.
saveFormatToLoadFormat(int saveFormat)
public static int saveFormatToLoadFormat(int saveFormat)
Converts a SaveFormat value to a LoadFormat value if possible.
Parameters:
Parameter | Type | Description |
---|---|---|
saveFormat | int | SaveFormat. The save format. |
Returns: int - LoadFormat. The load format
toString()
public String toString()
Returns: java.lang.String
verifyPassword(InputStream stream, String password)
public static boolean verifyPassword(InputStream stream, String password)
Detects and returns the information about a format of an excel stored in a stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | |
password | java.lang.String | The password for encrypted ooxml files. |
Returns: boolean - Returns whether the password is corrected.
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 |