Package 

Class ClamavClient

  • All Implemented Interfaces:

    
    public class ClamavClient
    
                        

    Kotlin ClamAV client

    • 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.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final InetSocketAddress getServer()
      final Platform getServerPlatform()
      final Unit ping() Pings the ClamAV daemon.
      final String version() Requests the version of the ClamAV daemon
      final String stats() Requests stats from the ClamAV daemon
      final Unit reloadVirusDatabases() Triggers the virus databases reloading by the ClamAV daemon
      final Unit shutdownServer() Immediately shutdowns the ClamAV daemon
      final ScanResult scan(InputStream inputStream) Scans an InputStream and sends a response as soon as a virus has been found.
      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 continueScan argument.
      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 continueScan argument.
      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.
      final Boolean isReachable(Integer timeout) Tries to connect to the ClamAV daemon until timeout expires.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 hostname
        serverPlatform - 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 hostname
        serverPort - Server port
        serverPlatform - 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 hostname
        serverPort - 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

      • ping

         final Unit ping()

        Pings the ClamAV daemon. If a correct response has been received, the method simply returns. Otherwise, a ClamavException is thrown.

      • version

         final String version()

        Requests the version of the ClamAV daemon

      • stats

         final String stats()

        Requests stats from the ClamAV daemon

      • scan

         final ScanResult scan(InputStream inputStream)

        Scans an InputStream and 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 continueScan argument.

        Parameters:
        path - absolute path to the file/directory on the filesystem of the ClamAV daemon
        continueScan - 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 continueScan argument.

        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.