public final class LocalScanner extends LocalScannerBase
Scanner
. This class handles simple scanning of files, string and buffers.Constructor and Description |
---|
LocalScanner()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelScanner()
Cancels the scanner and the scan in progress.
|
void |
destroy()
Destroys the scanner.
|
void |
loadSettings(java.io.File settingsFile)
Loads the settings from a file.
|
void |
loadSettings(java.lang.String settings)
Loads the settings from a string.
|
java.util.List<Threat> |
scanBuffer(byte[] buffer,
boolean stopAtFirstThreat,
java.lang.String fileName)
Executes a buffer scan.
|
void |
scanBuffer(byte[] buffer,
ThreatHandler threatHandler,
java.lang.String fileName)
Executes a buffer scan with a custom
ThreatHandler . |
java.util.List<Threat> |
scanFile(java.io.File file,
boolean stopAtFirstThreat)
Executes a file scan.
|
void |
scanFile(java.io.File file,
ThreatHandler threatHandler)
Executes a file scan with a custom
ThreatHandler . |
java.util.List<Threat> |
scanString(java.lang.String string,
boolean stopAtFirstThreat)
Executes a string scan.
|
void |
scanString(java.lang.String string,
ThreatHandler threatHandler)
Executes a string scan with a custom
ThreatHandler . |
isLicenseLoaded, isSettingsLoaded, loadLicense, loadLicense
public java.util.List<Threat> scanFile(java.io.File file, boolean stopAtFirstThreat) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.io.IOException, UnsupportedMimeTypeException, java.lang.Exception
file
- The file to be scanned.stopAtFirstThreat
- If true, it will stop after the first threat is found. If false, it will scan the whole file.Threat
.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 scanned.java.lang.Exception
- Generic exception.public void scanFile(java.io.File file, ThreatHandler threatHandler) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.io.IOException, UnsupportedMimeTypeException, java.lang.Exception
ThreatHandler
.file
- The file to be scanned.threatHandler
- The custom handler that returns and handles the threat.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 scanned.java.lang.Exception
- Generic exception.public java.util.List<Threat> scanString(java.lang.String string, boolean stopAtFirstThreat) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.lang.Exception
string
- The string to be scanned.stopAtFirstThreat
- If true, it will stop after the first threat is found. If false, it will scan the whole string.Threat
.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.lang.Exception
- Generic exception.public void scanString(java.lang.String string, ThreatHandler threatHandler) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.lang.Exception
ThreatHandler
.string
- The string to be scanned.threatHandler
- The custom handler that returns and handles the threat.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.lang.Exception
- Generic exception.public java.util.List<Threat> scanBuffer(byte[] buffer, boolean stopAtFirstThreat, java.lang.String fileName) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.lang.Exception
buffer
- The buffer to be scanned.stopAtFirstThreat
- If true, it will stop after the first threat is found. If false, it will scan the whole buffer.fileName
- If you scan the buffer from a file, specify the file name.Threat
.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.lang.Exception
- Generic exception.public void scanBuffer(byte[] buffer, ThreatHandler threatHandler, java.lang.String fileName) throws InvalidLicenseException, LicenseExpiredException, LicenseException, SettingsException, java.lang.Exception
ThreatHandler
.buffer
- The buffer to be scanned.threatHandler
- The custom handler that returns and handles the threat.fileName
- If you scan 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.java.lang.Exception
- Generic exception.public void loadSettings(java.io.File settingsFile) throws SettingsException, java.io.IOException, java.lang.Exception
settingsFile
- The file containing the settings.SettingsException
- If there was an error loading the settings.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, java.lang.Exception
settings
- The string containing the settings.SettingsException
- If there was an error loading the settings.java.lang.Exception
- Generic exception.public void cancelScanner()
LocalScanner
cannot be used again.public void destroy()