public final class LocalClassifier extends LocalClassifierBase
Classifier. This class handles simple classification of files, string and buffers.settingsLoader| Constructor and Description |
|---|
LocalClassifier(android.content.Context context)
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.
|
checkClassifyBufferExceptions, checkClassifyFileExceptions, checkClassifyStringExceptions, checkWriteStoragePermission, isLicenseLoaded, isSettingsLoaded, loadLicense, loadLicensepublic LocalClassifier(android.content.Context context)
throws NoPermissionException
LocalClassifier, make sure android.permission.WRITE_EXTERNAL_STORAGE is granted.context - The context.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.public boolean classifyFile(java.io.File file)
throws InvalidLicenseException,
LicenseExpiredException,
LicenseException,
SettingsException,
NoPermissionException,
java.io.IOException,
UnsupportedMimeTypeException,
java.lang.Exception
file - The file to be classified.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.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.java.io.IOException - If there was an error reading the file.UnsupportedMimeTypeException - If this type of file cannot be classified.java.lang.Exception - Generic exception.public boolean classifyString(java.lang.String string)
throws InvalidLicenseException,
LicenseExpiredException,
LicenseException,
SettingsException,
NoPermissionException,
java.lang.Exception
string - The string to be classified.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.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.java.lang.Exception - Generic exception.public boolean classifyBuffer(byte[] buffer,
java.lang.String fileName)
throws InvalidLicenseException,
LicenseExpiredException,
LicenseException,
SettingsException,
NoPermissionException,
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.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.java.lang.Exception - Generic exception.public void loadSettings(java.io.File settingsFile)
throws SettingsException,
NoPermissionException,
java.io.IOException,
java.lang.Exception
loadSettings in class LocalClassifierBasesettingsFile - The file containing the settings.SettingsException - If there was an error loading the settings.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.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,
NoPermissionException,
java.lang.Exception
loadSettings in class LocalClassifierBasesettings - The string containing the settings.SettingsException - If there was an error loading the settings.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.java.lang.Exception - Generic exception.public void cancelClassifier()
LocalClassifier cannot be used again.public void destroy()