-
- All Implemented Interfaces:
public class ClamavClientKotlin ClamAV client
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classClamavClient.Companion
-
Field Summary
Fields Modifier and Type Field Description private final InetSocketAddressserverprivate final PlatformserverPlatform
-
Constructor Summary
Constructors Constructor Description ClamavClient(String serverHostname, Platform serverPlatform)Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname running on the given platform. ClamavClient(String serverHostname, Integer serverPort, Platform serverPlatform)Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform. ClamavClient(String serverHostname, Integer serverPort)Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform. ClamavClient(String serverHostname)Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform. ClamavClient(InetSocketAddress server, Platform serverPlatform)Creates a ClamavClient which will connect to the ClamAV daemon on the given socket address running on the given platform. ClamavClient(InetSocketAddress server)Creates a ClamavClient which will connect to the ClamAV daemon on the given socket address running on the given platform.
-
Method Summary
Modifier and Type Method Description final InetSocketAddressgetServer()final PlatformgetServerPlatform()final Unitping()Pings the ClamAV daemon. final Stringversion()Requests the version of the ClamAV daemon final Stringstats()Requests stats from the ClamAV daemon final UnitreloadVirusDatabases()Triggers the virus databases reloading by the ClamAV daemon final UnitshutdownServer()Immediately shutdowns the ClamAV daemon final ScanResultscan(InputStream inputStream)Scans an InputStreamand sends a response as soon as a virus has been found.final ScanResultscan(Path path, Boolean continueScan)Scans a file/directory on the filesystem of the ClamAV daemon and may continue the scan to the end even if a virus has been found, depending on the continueScanargument.final ScanResultscan(Path path)Scans a file/directory on the filesystem of the ClamAV daemon and may continue the scan to the end even if a virus has been found, depending on the continueScanargument.final ScanResultparallelScan(Path path)Scans a file/directory on the filesystem of the ClamAV daemon and will continue the scan to the end even if a virus has been found. final BooleanisReachable(Integer timeout)Tries to connect to the ClamAV daemon until timeout expires. -
-
Constructor Detail
-
ClamavClient
ClamavClient(String serverHostname, Platform serverPlatform)
Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname running on the given platform.- Parameters:
serverHostname- Server hostnameserverPlatform- Server platform (determines the file path separator to use when launching a file/directory scan on the server filesystem)
-
ClamavClient
ClamavClient(String serverHostname, Integer serverPort, Platform serverPlatform)
Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform.- Parameters:
serverHostname- Server hostnameserverPort- Server portserverPlatform- Server platform (determines the file path separator to use when launching a file/directory scan on the server filesystem)
-
ClamavClient
ClamavClient(String serverHostname, Integer serverPort)
Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform.- Parameters:
serverHostname- Server hostnameserverPort- Server port
-
ClamavClient
ClamavClient(String serverHostname)
Creates a ClamavClient which will connect to the ClamAV daemon on the given hostname and port running on the given platform.- Parameters:
serverHostname- Server hostname
-
ClamavClient
ClamavClient(InetSocketAddress server, Platform serverPlatform)
Creates a ClamavClient which will connect to the ClamAV daemon on the given socket address running on the given platform.
-
ClamavClient
ClamavClient(InetSocketAddress server)
Creates a ClamavClient which will connect to the ClamAV daemon on the given socket address running on the given platform.
-
-
Method Detail
-
getServer
final InetSocketAddress getServer()
-
getServerPlatform
final Platform getServerPlatform()
-
ping
final Unit ping()
Pings the ClamAV daemon. If a correct response has been received, the method simply returns. Otherwise, a ClamavException is thrown.
-
reloadVirusDatabases
final Unit reloadVirusDatabases()
Triggers the virus databases reloading by the ClamAV daemon
-
shutdownServer
final Unit shutdownServer()
Immediately shutdowns the ClamAV daemon
-
scan
final ScanResult scan(InputStream inputStream)
Scans an
InputStreamand sends a response as soon as a virus has been found.- Parameters:
inputStream- inputStream to scan
-
scan
@JvmOverloads() final ScanResult scan(Path path, Boolean continueScan)
Scans a file/directory on the filesystem of the ClamAV daemon and may continue the scan to the end even if a virus has been found, depending on the
continueScanargument.- Parameters:
path- absolute path to the file/directory on the filesystem of the ClamAV daemoncontinueScan- continue the scan to the end even if a virus has been found
-
scan
@JvmOverloads() final ScanResult scan(Path path)
Scans a file/directory on the filesystem of the ClamAV daemon and may continue the scan to the end even if a virus has been found, depending on the
continueScanargument.- Parameters:
path- absolute path to the file/directory on the filesystem of the ClamAV daemon
-
parallelScan
final ScanResult parallelScan(Path path)
Scans a file/directory on the filesystem of the ClamAV daemon and will continue the scan to the end even if a virus has been found. This method may improve performances on SMP systems by performing a multi-threaded scan.
- Parameters:
path- absolute path to the file/directory on the filesystem of the ClamAV daemon
-
isReachable
final Boolean isReachable(Integer timeout)
Tries to connect to the ClamAV daemon until timeout expires.
- Parameters:
timeout- the timeout value to be used in milliseconds.
-
-
-
-