FileFormatUtil

Inheritance: java.lang.Object

public class FileFormatUtil

Provides utility methods for converting file format enums to strings or file extensions and back.

Methods

MethodDescription
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:

ParameterTypeDescription
streamjava.io.InputStreamThe 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:

ParameterTypeDescription
streamjava.io.InputStream
passwordjava.lang.StringThe 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:

ParameterTypeDescription
filePathjava.lang.StringThe 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:

ParameterTypeDescription
filePathjava.lang.StringThe file path.
passwordjava.lang.StringThe password for encrypted ooxml files.

Returns: FileFormatInfo - A FileFormatInfo object that contains the detected information.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.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:

ParameterTypeDescription
extensionjava.lang.StringThe 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:

ParameterTypeDescription
formatintFileFormatType. 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:

ParameterTypeDescription
extensionjava.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:

ParameterTypeDescription
loadFormatintLoadFormat. 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:

ParameterTypeDescription
loadFormatintLoadFormat. 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:

ParameterTypeDescription
formatintSaveFormat. 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:

ParameterTypeDescription
saveFormatintSaveFormat. 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:

ParameterTypeDescription
streamjava.io.InputStream
passwordjava.lang.StringThe 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:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int