public class ClamAVClient extends Object
| Constructor and Description |
|---|
ClamAVClient(String hostName,
int port) |
ClamAVClient(String hostName,
int port,
int timeout) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isCleanReply(byte[] reply)
Interpret the result from a ClamAV scan, and determine if the result means the data is clean
|
boolean |
ping()
Run PING command to clamd to test it is responding.
|
byte[] |
scan(byte[] in)
Scans bytes for virus by passing the bytes to clamav
|
byte[] |
scan(InputStream is)
Streams the given data to the server in chunks.
|
public ClamAVClient(String hostName, int port, int timeout)
hostName - The hostname of the server running clamav-daemonport - The port that clamav-daemon listens to(By default it might not listen to a port. Check your clamav configuration).timeout - zero means infinite timeout. Not a good idea, but will be accepted.public ClamAVClient(String hostName, int port)
public boolean ping()
throws IOException
IOExceptionpublic byte[] scan(InputStream is) throws IOException
scan(byte[] in).
Opens a socket and reads the reply. Parameter input stream is NOT closed.
is - data to scan. Not closed by this method!IOExceptionpublic byte[] scan(byte[] in)
throws IOException
in - data to scanIOExceptionpublic static boolean isCleanReply(byte[] reply)
reply - The reply from the server after scanningCopyright © 2016. All rights reserved.