public final class FileFormatChecker extends Object implements com.aspose.ms.System.IDisposable, Closeable
Verifies file signature for different formats.
Constructor and Description |
---|
FileFormatChecker(InputStream stream)
Initializes a new instance of the
FileFormatChecker class. |
FileFormatChecker(String filePath)
Initializes a new instance of the
FileFormatChecker class. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
int |
getDocumentType()
Verifies file stream and returns appropriate
DocumentType . |
boolean |
verifyFormat(int documentType)
Determines whether file has specific format.
|
public FileFormatChecker(InputStream stream)
Initializes a new instance of the FileFormatChecker
class.
stream
- Checked file stream.ArgumentNullException
- Stream could not be null.com.aspose.ms.System.ArgumentException
- Stream should be seekable.public FileFormatChecker(String filePath)
Initializes a new instance of the FileFormatChecker
class.
filePath
- Absolute path to the checked file.public final int getDocumentType()
Verifies file stream and returns appropriate DocumentType
.
DocumentType
if file is recognized; otherwise DocumentType.Unknown
.public final boolean verifyFormat(int documentType)
Determines whether file has specific format.
documentType
- Checked document type.documentType
type; otherwise false.public final void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
dispose
in interface com.aspose.ms.System.IDisposable
public final void close()
close
in interface Closeable
close
in interface AutoCloseable