sensitivity.io for iOS & macOS  1.1.4
Instance Methods | List of all members
Scanner Class Reference

#import <Scanner.h>

Inheritance diagram for Scanner:

Instance Methods

(instancetype _Nullable) - initWithError:
 
(BOOL) - cancelScanWithError:
 
(BOOL) - isCanceled:withError:
 
(BOOL) - scanString:withThreatHandler:withError:
 
(BOOL) - scanData:withThreatHandler:fileName:withError:
 
(BOOL) - scanFileAtPath:withThreatHandler:withError:
 
(NSArray< ThreatInfo * > *_Nullable) - scanString:stopAtFirstThreat:withError:
 
(NSArray< ThreatInfo * > *_Nullable) - scanData:stopAtFirstThreat:fileName:withError:
 
(NSArray< ThreatInfo * > *_Nullable) - scanFileAtPath:stopAtFirstThreat:withError:
 

Detailed Description

Scanner class provides the means to scan texts, data and files. Before performing any scans the scanner module needs to have its resources initialized, the license needs to be loaded, the scanner needs to be registered with a settings loader and the scanner settings need to be loaded with that settings loader. When cancelling a scanner, it will become invalid, so in order to perform a new scan you need to create a new instance of Scanner.

Method Documentation

◆ cancelScanWithError:()

- (BOOL) cancelScanWithError: (NSError *_Nullable *_Nullable)  error

Cancels current scan

Note
The scanner object is invalidated when scan is canceled and no other scan can be done with the canceled scanner.
Parameters
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ initWithError:()

- (instancetype _Nullable) initWithError: (NSError *_Nullable *_Nullable)  error

Initializes a new object immediately after memory for it has been allocated

Note
The designated initializer
Parameters
errorThe error representing the reason for the failure
Returns
The initialized object

◆ isCanceled:withError:()

- (BOOL) isCanceled: (BOOL *_Nonnull)  canceled
withError: (NSError *_Nullable *_Nullable)  error 

Checks if scanner is canceled

Parameters
canceledWill be set to the canceled status in case the check was successful
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ scanData:stopAtFirstThreat:fileName:withError:()

- (NSArray<ThreatInfo *> * _Nullable) scanData: (NSData *_Nonnull)  data
stopAtFirstThreat: (BOOL)  stopAtFirst
fileName: (NSString *_Nullable)  fileName
withError: (NSError *_Nullable *_Nullable)  error 

Scans data for threats.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, EIO
Parameters
dataThe data that needs to be scanned
stopAtFirstIf true, the scan will stop on first found threat, otherwise it will scan the whole data
fileNameIf data is the content of a file, pass file name (otherwise it may be nil or empty string)
errorThe error representing the reason for the failure
Returns
The threats found or nil in case an error occured

◆ scanData:withThreatHandler:fileName:withError:()

- (BOOL) scanData: (NSData *_Nonnull)  data
withThreatHandler: (ThreatHandler *_Nonnull)  threatHandler
fileName: (NSString *_Nullable)  fileName
withError: (NSError *_Nullable *_Nullable)  error 

Scans data for threats using threat handler.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, EIO
Parameters
dataThe data that needs to be scanned
threatHandlerThe threat handler
fileNameIf data is the content of a file, pass file name (otherwise it may be nil or empty string)
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ scanFileAtPath:stopAtFirstThreat:withError:()

- (NSArray<ThreatInfo *> * _Nullable) scanFileAtPath: (NSString *_Nonnull)  filePath
stopAtFirstThreat: (BOOL)  stopAtFirst
withError: (NSError *_Nullable *_Nullable)  error 

Scans file for threats.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, ENOENT, EIO
Parameters
filePathThe path of the file that needs to be scanned
stopAtFirstIf true, the scan will stop on first found threat, otherwise it will scan the whole file
errorThe error representing the reason for the failure
Returns
The threats found or nil in case an error occured

◆ scanFileAtPath:withThreatHandler:withError:()

- (BOOL) scanFileAtPath: (NSString *_Nonnull)  filePath
withThreatHandler: (ThreatHandler *_Nonnull)  threatHandler
withError: (NSError *_Nullable *_Nullable)  error 

Scans file for threats using threat handler.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, ENOENT, EIO
Parameters
filePathThe path of the file that needs to be scanned
threatHandlerThe threat handler
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ scanString:stopAtFirstThreat:withError:()

- (NSArray<ThreatInfo *> * _Nullable) scanString: (NSString *_Nonnull)  text
stopAtFirstThreat: (BOOL)  stopAtFirst
withError: (NSError *_Nullable *_Nullable)  error 

Scans provided text for threats.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, ECANCELED, EIO
Parameters
textThe text to scan
stopAtFirstIf true, the scan will stop on first found threat, otherwise it will scan the whole string
errorThe error representing the reason for the failure
Returns
The threats found or nil in case an error occured

◆ scanString:withThreatHandler:withError:()

- (BOOL) scanString: (NSString *_Nonnull)  text
withThreatHandler: (ThreatHandler *_Nonnull)  threatHandler
withError: (NSError *_Nullable *_Nullable)  error 

Scans provided text for threats using threat handler.

Precondition
Module resources initialized, valid license and settings, at least one license feature and settings criteria is enabled.
Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, ECANCELED, EIO
Parameters
textThe text to scan
threatHandlerThe threat handler
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

The documentation for this class was generated from the following file: