Class VirusScannerImpl

  • All Implemented Interfaces:
    io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>

    @Component
    public class VirusScannerImpl
    extends Object
    implements io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>
    The implementation Class for VirusScannerService.
    Author:
    Mukul Puspam, Pranav Kumar
    • Field Detail

      • clamavClient

        protected xyz.capybara.clamav.ClamavClient clamavClient
        The clamav client.
    • Constructor Detail

      • VirusScannerImpl

        public VirusScannerImpl()
    • Method Detail

      • createConnection

        public void createConnection()
        Creates the connection to client.
      • scanFile

        public Boolean scanFile​(String fileName)
        Specified by:
        scanFile in interface io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>
      • scanFolder

        public Boolean scanFolder​(String folderPath)
        Specified by:
        scanFolder in interface io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>
      • scanDocument

        public Boolean scanDocument​(byte[] docArray)
                             throws IOException
        This Method is used to scan byte array
        Specified by:
        scanDocument in interface io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>
        Parameters:
        docArray - array
        Returns:
        a true if file is virus free and false if file is infected
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • scanDocument

        public Boolean scanDocument​(File doc)
                             throws IOException
        This Method is used to scan File
        Specified by:
        scanDocument in interface io.mosip.kernel.core.virusscanner.spi.VirusScanner<Boolean,​InputStream>
        Parameters:
        doc - object
        Returns:
        a true if file is virus free and false if file is infected
        Throws:
        IOException - Signals that an I/O exception has occurred.