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 InputStreamScannerChain

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.torweg.pulse.util.streamscanner.InputStreamScannerChain
All Implemented Interfaces:
java.io.Closeable

public final class InputStreamScannerChain
extends java.io.FilterInputStream

is an analogon to OutputStreamScannerChain for use with InputStreams; for more information see OutputStreamScannerChain.

Version:
$Revision: 1914 $
Author:
Thomas Weber

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
InputStreamScannerChain(java.io.InputStream in, java.lang.String ct, User u)
          creates a new OutputStreamScannerChain for the given OutputStream.
 
Method Summary
 void close()
          closes the scanner chain and its underlying stream.
 int read()
          reads, scans and returns the next byte of the underlying InputStream.
 int read(byte[] b)
          reads, scans and then returns the given byte array to the underlying InputStream.
 int read(byte[] b, int off, int len)
          reads, scans and then returns len bytes from the specified byte array starting at offset off to the underlying InputStream.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamScannerChain

public InputStreamScannerChain(java.io.InputStream in,
                               java.lang.String ct, User u)
creates a new OutputStreamScannerChain for the given OutputStream.

Parameters:
in - the InputStream to be filtered
ct - the content-type of the scanned stream
u - the user
Method Detail

read

public int read(byte[] b)
         throws StreamException, InacceptableStreamException
reads, scans and then returns the given byte array to the underlying InputStream.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the byte array to be read
Returns:
the number of bytes read
Throws:
StreamException - on errors writing to the underlying stream
InacceptableStreamException - if the scanned stream is not acceptable (e.g. it contains a virus)

read

public int read(byte[] b,
                int off,
                int len)
         throws StreamException, InacceptableStreamException
reads, scans and then returns len bytes from the specified byte array starting at offset off to the underlying InputStream.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the byte array
off - the offset
len - the length
Returns:
the number of bytes read
Throws:
StreamException - on errors writing to the underlying stream
InacceptableStreamException - if the scanned stream is not acceptable (e.g. it contains a virus)

read

public int read()
         throws StreamException, InacceptableStreamException
reads, scans and returns the next byte of the underlying InputStream.

Overrides:
read in class java.io.FilterInputStream
Returns:
the read byte as an int or -1, if the end of the stream has been reached
Throws:
StreamException - on errors writing to the underlying stream
InacceptableStreamException - if the scanned stream is not acceptable (e.g. it contains a virus)

close

public void close()
           throws java.io.IOException, InacceptableStreamException
closes the scanner chain and its underlying stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException - on errors closing the underlying stream or any of the scanners
InacceptableStreamException - if the scanned stream is not acceptable (e.g. it contains a virus)