@Override
    public void scan(UploadedFile file) {
        try {
            InputStream inputStream = new ByteArrayInputStream(file.getContent());
            byte[] reply = getClamAvClient().scan(inputStream);

            String message = new String(reply, StandardCharsets.US_ASCII).trim();

            LOGGER.log(Level.FINE, "Scanner replied with message: {0}", message);

            if (!ClamDaemonClient.isCleanReply(reply)) {
                String error = createErrorMessage(file, message);
                LOGGER.log(Level.WARNING, "ClamAV Error: {0}", error);
                throw new VirusException(error);
            }
        }
        catch (VirusException ex) {
            throw ex;
        }
        catch (RuntimeException | IOException ex) {
            String error = String.format("Unexpected error scanning file - %s", ex.getMessage());
            throw new VirusException(error);
        }
    }
Scan file using send to ClamAV service running at host and port over TCP.

@throws VirusException if a virus has been detected by the scanner
primefaces/src/main/java/org/primefaces/virusscan/impl/ClamDaemonScanner.java