public class IcapClient extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ICAP_PORT
Default ICAP port
|
static String |
EICARTEST |
static String |
HTTP_TERMINATOR |
static String |
ICAP_TERMINATOR |
static String |
TERMINATOR |
static String |
VERSION |
Constructor and Description |
---|
IcapClient(String serverIP,
int port,
String icapService)
This creates the ICAP client without connecting immediately to the ICAP
server.
|
IcapClient(String serverIP,
int port,
String icapService,
int previewSize)
This creates the ICAP client without connecting immediately to the ICAP
server.
|
public static final int DEFAULT_ICAP_PORT
public static final String VERSION
public static final String TERMINATOR
public static final String ICAP_TERMINATOR
public static final String HTTP_TERMINATOR
public static final String EICARTEST
public IcapClient(String serverIP, int port, String icapService)
serverIP
- The IP address to connect to.port
- The port in the host to use.icapService
- The service to use (fx "avscan").public IcapClient(String serverIP, int port, String icapService, int previewSize)
serverIP
- The IP address to connect to.port
- The port in the host to use.icapService
- The service to use (fx "avscan").previewSize
- Amount of bytes to send as preview.public final IcapClient connect() throws IcapException
IcapException
- if an issue occurs during the connection or
response (the connection is already closed)public final void close()
close
in interface Closeable
close
in interface AutoCloseable
public final boolean scanFile(String filename) throws IcapException
filename
- Relative or absolute file path to a file. If filename is
EICARTEST, then a build on the fly EICAR test file is sent.IcapException
- if an error occurs (network, file reading,
bad headers)public final String getServerIP()
public final int getPort()
public final String getIcapService()
public final int getPreviewSize()
public final IcapClient setPreviewSize(int previewSize)
previewSize
- the receive length to setpublic final int getReceiveLength()
public final IcapClient setReceiveLength(int receiveLength)
receiveLength
- the receive length to setpublic final int getSendLength()
public final IcapClient setSendLength(int sendLength)
sendLength
- the send length to setpublic final long getMaxSize()
public final IcapClient setMaxSize(long maxSize)
maxSize
- the maximum file size to setpublic final long getTimeout()
public final IcapClient setTimeout(int timeout)
timeout
- the timeout to use on connectionpublic final String getKeyIcapPreview()
public final IcapClient setKeyIcapPreview(String keyIcapPreview)
keyIcapPreview
- the key in ICAP headers to find with 200 status in
PREVIEW (or null if none)public final String getSubStringFromKeyIcapPreview()
public final IcapClient setSubStringFromKeyIcapPreview(String subStringFromKeyIcapPreview)
subStringFromKeyIcapPreview
- the subString to find in key ICAP header
with 200 status in PREVIEW (or null if none)public final String getSubstringHttpStatus200()
public final IcapClient setSubstringHttpStatus200(String substringHttpStatus200)
substringHttpStatus200
- the subString to find in Http with 200 status
(or null if none)public final String getKeyIcap200()
public final IcapClient setKeyIcap200(String keyIcap200)
keyIcap200
- the key in ICAP headers to find with 200 status
(or null if none)public final String getSubStringFromKeyIcap200()
public final IcapClient setSubStringFromKeyIcap200(String subStringFromKeyIcap200)
subStringFromKeyIcap200
- the subString to find in key ICAP header with 200 status
(or null if none)public final String getKeyIcap204()
public final IcapClient setKeyIcap204(String keyIcap204)
keyIcap204
- the key in ICAP headers to find with 204 status
(or null if none)public final String getSubStringFromKeyIcap204()
public final IcapClient setSubStringFromKeyIcap204(String subStringFromKeyIcap204)
subStringFromKeyIcap204
- the subString to find in key ICAP header with 204 status
(or null if none)Copyright © 2009–2022 Waarp. All rights reserved.