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
Interface IStreamScanner

All Known Implementing Classes:
ClamAVScanner, MimeSniffingScanner

public interface IStreamScanner

is an interface for input stream scanners, such as virus scanners etc.

Note: the implementations IStreamScanner are not thread-safe.

Implementations that need the StreamScannerConfig of the chain for additional configurations, must implement Configurable.

Version:
$Revision: 1933 $
Author:
Thomas Weber

Method Summary
 void close()
          called upon close of the scanned stream to signal the end of the scanning.
 void scan(byte[] b)
          scans the given byte array; mimics OutputStream.write(byte[]).
 void scan(int b)
          scans the given byte.
 void setContentType(java.lang.String t)
          sets the content-type of the scanned content, as this might be important for some of the scanners, e.g. protection against the MIME-sniffing capabilities of Internet Explorer.
 void setUser(User u)
          sets the user for the scanner.
 void shutdown()
          unconditionally frees all resources of the IStreamScanner catching all Exceptions.
 

Method Detail

setContentType

void setContentType(java.lang.String t)
sets the content-type of the scanned content, as this might be important for some of the scanners, e.g. protection against the MIME-sniffing capabilities of Internet Explorer.

Parameters:
t - the content-type

setUser

void setUser(User u)
sets the user for the scanner.

Parameters:
u - the user

scan

void scan(byte[] b)
          throws InacceptableStreamException
scans the given byte array; mimics OutputStream.write(byte[]).

Parameters:
b - the byte array to be scanned
Throws:
InacceptableStreamException - if the stream is unacceptable due to this scanner

scan

void scan(int b)
          throws InacceptableStreamException
scans the given byte.

Parameters:
b - the byte
Throws:
InacceptableStreamException - if the stream is unacceptable due to this scanner

close

void close()
           throws InacceptableStreamException, StreamException
called upon close of the scanned stream to signal the end of the scanning.

Throws:
InacceptableStreamException - if the stream is unacceptable due to this scanner
StreamException - on errors closing the scanner

shutdown

void shutdown()
unconditionally frees all resources of the IStreamScanner catching all Exceptions.