pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.streamscanner
Class ClamAVScanner

java.lang.Object
  extended by org.torweg.pulse.util.streamscanner.ClamAVScanner
All Implemented Interfaces:
Configurable<ClamAVScannerConfig>, IStreamScanner

public class ClamAVScanner
extends java.lang.Object
implements IStreamScanner, Configurable<ClamAVScannerConfig>

a virus stream scanner using ClamAV's clamd for scanning.

Version:
$Revision: 1914 $
Author:
Thomas Weber

Constructor Summary
ClamAVScanner()
          default constructor.
 
Method Summary
 void close()
          called upon close of the scanned stream to signal the end of the scanning.
 void initialize(ClamAVScannerConfig conf)
          injects the configuration.
 void scan(byte[] b)
          scans the given byte array.
 void scan(int b)
          delegates to scan(byte[]).
 void setContentType(java.lang.String t)
          does nothing, as this scanner is independent of content-types.
 void setUser(User u)
          does nothing, as this scanner does the same for all users.
 void shutdown()
          unconditionally frees all resources of this scanner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClamAVScanner

public ClamAVScanner()
default constructor.

Method Detail

setContentType

public void setContentType(java.lang.String t)
does nothing, as this scanner is independent of content-types.

Specified by:
setContentType in interface IStreamScanner
Parameters:
t - the content-type
See Also:
IStreamScanner.setContentType(java.lang.String)

setUser

public void setUser(User u)
does nothing, as this scanner does the same for all users.

Specified by:
setUser in interface IStreamScanner
Parameters:
u - the user
See Also:
IStreamScanner.setUser(User)

scan

public final void scan(byte[] b)
                throws StreamException, InacceptableStreamException
scans the given byte array.

Specified by:
scan in interface IStreamScanner
Parameters:
b - the byte array to scan
Throws:
StreamException - on errors communicating with ClamAV
InacceptableStreamException - if the stream contains a virus

scan

public final void scan(int b)
                throws InacceptableStreamException
delegates to scan(byte[]).

Specified by:
scan in interface IStreamScanner
Parameters:
b - the byte to filter
Throws:
InacceptableStreamException - if the stream contains a virus

close

public final void close()
                 throws InacceptableStreamException, StreamException
Description copied from interface: IStreamScanner
called upon close of the scanned stream to signal the end of the scanning.

Specified by:
close in interface IStreamScanner
Throws:
StreamException - on errors with the underlying streams
InacceptableStreamException - if the scanned stream is inacceptable

initialize

public void initialize(ClamAVScannerConfig conf)
injects the configuration.

Specified by:
initialize in interface Configurable<ClamAVScannerConfig>
Parameters:
conf - the configuration to inject
See Also:
ClamAVScannerConfig

shutdown

public void shutdown()
unconditionally frees all resources of this scanner.

Specified by:
shutdown in interface IStreamScanner