public class LocalClassifierBase
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected ClassifierSettingsLoader |
settingsLoader |
| Modifier | Constructor and Description |
|---|---|
protected |
LocalClassifierBase(android.content.Context context)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkClassifyBufferExceptions(byte[] buffer)
Checks for exceptions before classifying a buffer.
|
protected void |
checkClassifyFileExceptions(java.io.File file)
Checks for exceptions before classifying a file.
|
protected void |
checkClassifyStringExceptions(java.lang.String string)
Checks for exceptions before classifying a string.
|
protected void |
checkWriteStoragePermission()
Checks if android.permission.WRITE_EXTERNAL_STORAGE is granted before classificating a file.
|
boolean |
isLicenseLoaded()
Checks if the license is loaded.
|
boolean |
isSettingsLoaded()
Checks if the settings are loaded.
|
void |
loadLicense(java.io.File licenseFile)
Loads the license from a file.
|
void |
loadLicense(java.lang.String license)
Loads the license from a string.
|
protected void |
loadSettings(java.io.File settingsFile)
Loads the settings from a file.
|
protected void |
loadSettings(java.lang.String settings)
Loads the settings from a string.
|
protected ClassifierSettingsLoader settingsLoader
protected LocalClassifierBase(android.content.Context context)
context - The Context.public void loadLicense(java.io.File licenseFile)
throws InvalidLicenseException,
java.io.IOException,
java.lang.Exception
licenseFile - The file containing the license.InvalidLicenseException - If the license has an invalid format.java.io.IOException - If there was an error reading the file.java.lang.Exception - Generic exception.public void loadLicense(java.lang.String license)
throws InvalidLicenseException,
java.lang.Exception
license - The string containing the license.InvalidLicenseException - If the license has an invalid format.java.lang.Exception - Generic exception.protected void loadSettings(java.io.File settingsFile)
throws SettingsException,
NoPermissionException,
java.io.IOException,
java.lang.Exception
settingsFile - 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.protected void loadSettings(java.lang.String settings)
throws SettingsException,
NoPermissionException,
java.lang.Exception
settings - 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 boolean isLicenseLoaded()
public boolean isSettingsLoaded()
protected void checkClassifyFileExceptions(java.io.File file)
throws LicenseException,
SettingsException,
NoPermissionException,
java.io.IOException
file - The file to be classified.LicenseException - If license is not loaded.SettingsException - If settings are not loaded.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.java.io.IOException - If there was an error reading the file.protected void checkClassifyStringExceptions(java.lang.String string)
throws LicenseException,
SettingsException,
NoPermissionException
string - The string to be classified.LicenseException - If license is not loaded.SettingsException - If settings are not loaded.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.protected void checkClassifyBufferExceptions(byte[] buffer)
throws LicenseException,
SettingsException,
NoPermissionException
buffer - The buffer to be classified.LicenseException - If license is not loaded.SettingsException - If settings are not loaded.NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.protected void checkWriteStoragePermission()
throws NoPermissionException
NoPermissionException - If android.permission.WRITE_EXTERNAL_STORAGE is not granted.