Package org.craftercms.virusscanner.impl
Class ClamavVirusScannerImpl
- java.lang.Object
-
- org.craftercms.virusscanner.impl.ClamavVirusScannerImpl
-
- All Implemented Interfaces:
VirusScanner
public class ClamavVirusScannerImpl extends Object implements VirusScanner
A virus scanner that uses ClamScan to scan input-streams/files
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILE_NOT_FOUND_MESSAGE
static String
SCAN_FAILED_MESSAGE
static String
THREAT_FOUND_MESSAGE
-
Constructor Summary
Constructors Constructor Description ClamavVirusScannerImpl()
ClamavVirusScannerImpl(String host, int port, int timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getHost()
int
getPort()
int
getTimeout()
void
scan(InputStream inputStream)
Scans theInputStream
for viruses.void
scan(String filename)
Scans the file for virus.void
setHost(String host)
void
setPort(int port)
void
setTimeout(int timeout)
-
-
-
Field Detail
-
THREAT_FOUND_MESSAGE
public static final String THREAT_FOUND_MESSAGE
- See Also:
- Constant Field Values
-
FILE_NOT_FOUND_MESSAGE
public static final String FILE_NOT_FOUND_MESSAGE
- See Also:
- Constant Field Values
-
SCAN_FAILED_MESSAGE
public static final String SCAN_FAILED_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClamavVirusScannerImpl
public ClamavVirusScannerImpl()
-
ClamavVirusScannerImpl
public ClamavVirusScannerImpl(String host, int port, int timeout)
- Parameters:
host
- the clamd server hostport
- the clamd server porttimeout
- milliseconds to wait for the connection
-
-
Method Detail
-
scan
public void scan(String filename)
Scans the file for virus.- Specified by:
scan
in interfaceVirusScanner
- Parameters:
filename
- full path
-
scan
public void scan(InputStream inputStream)
Scans theInputStream
for viruses.- Specified by:
scan
in interfaceVirusScanner
- Parameters:
inputStream
-
-
setHost
public void setHost(String host)
- Parameters:
host
- the clamd server host
-
setPort
public void setPort(int port)
- Parameters:
port
- the clamd server port
-
setTimeout
public void setTimeout(int timeout)
- Parameters:
timeout
- milliseconds to wait for the connection
-
getHost
public String getHost()
- Returns:
- the clamd server host
-
getPort
public int getPort()
- Returns:
- the clamd server port
-
getTimeout
public int getTimeout()
- Returns:
- the milliseconds to wait for the connection
-
-