public final class LocalClassifier extends LocalClassifierBase
Classifier
. This class handles simple classification of files, string and buffers.Constructor and Description |
---|
LocalClassifier()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelClassifier()
Cancels the classifier and the classification in progress.
|
boolean |
classifyBuffer(byte[] buffer,
java.lang.String fileName)
Executes a buffer classification.
|
boolean |
classifyFile(java.io.File file)
Executes a file classification.
|
boolean |
classifyString(java.lang.String string)
Executes a string classification.
|
void |
destroy()
Destroys the classifier.
|
void |
loadSettings(java.io.File settingsFile)
Loads the settings from a file.
|
void |
loadSettings(java.lang.String settings)
Loads the settings from a string.
|
isLicenseLoaded, isSettingsLoaded, loadLicense, loadLicense
public boolean classifyFile(java.io.File file) throws InvalidArgumentException, java.io.FileNotFoundException, InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.io.IOException, UnsupportedMimeTypeException, NoKnownDataException, java.lang.Exception
file
- The file to be classified.InvalidArgumentException
- If file parameter is null.java.io.FileNotFoundException
- If the file does not exist.InvalidLicenseException
- If the license is invalid.LicenseExpiredException
- If the license is expired.LicenseException
- If the license is not loaded.SettingsException
- If the settings are invalid or not loaded.java.io.IOException
- If there was an error reading the file.UnsupportedMimeTypeException
- If this type of file cannot be classified.NoKnownDataException
- If this file cannot be classified.java.lang.Exception
- Generic exception.public boolean classifyString(java.lang.String string) throws InvalidArgumentException, InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, NoKnownDataException, java.lang.Exception
string
- The string to be classified.InvalidArgumentException
- If string parameter is null or empty.InvalidLicenseException
- If the license is invalid.LicenseExpiredException
- If the license is expired.LicenseException
- If the license is not loaded.SettingsException
- If the settings are invalid or not loaded.NoKnownDataException
- If this file cannot be classified.java.lang.Exception
- Generic exception.public boolean classifyBuffer(byte[] buffer, java.lang.String fileName) throws InvalidArgumentException, InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, NoKnownDataException, java.lang.Exception
buffer
- The buffer to be classified.fileName
- If you classify the buffer from a file, specify the file name.InvalidLicenseException
- If the license is invalid.LicenseExpiredException
- If the license is expired.LicenseException
- If the license is not loaded.SettingsException
- If the settings are invalid or not loaded.NoKnownDataException
- If this file cannot be classified.java.lang.Exception
- Generic exception.InvalidArgumentException
public void loadSettings(java.io.File settingsFile) throws SettingsException, InvalidArgumentException, java.io.FileNotFoundException, java.io.IOException, java.lang.Exception
settingsFile
- The file containing the settings.InvalidArgumentException
- If settingsFile argument is null.SettingsException
- If there was an error loading the settings.java.io.FileNotFoundException
- If the settings file does not exist.java.io.IOException
- If there was an error reading the file.java.lang.Exception
- Generic exception.public void loadSettings(java.lang.String settings) throws SettingsException, InvalidArgumentException, java.lang.Exception
settings
- The string containing the settings.InvalidArgumentException
- If settings argument is null or empty.SettingsException
- If there was an error loading the settings.java.lang.Exception
- Generic exception.public void cancelClassifier()
LocalClassifier
cannot be used again.public void destroy()