FileDocCategorySizeDatePackage
CloseShieldInputStream.javaAPI DocAndroid 1.5 API3766Wed May 06 22:42:46 BST 2009org.apache.james.mime4j

CloseShieldInputStream

public class CloseShieldInputStream extends InputStream
InputStream that shields its underlying input stream from being closed.
version
$Id: CloseShieldInputStream.java,v 1.2 2004/10/02 12:41:10 ntherning Exp $

Fields Summary
private InputStream
is
Underlying InputStream
Constructors Summary
public CloseShieldInputStream(InputStream is)

        this.is = is;
    
Methods Summary
public intavailable()

see
java.io.InputStream#available()

        checkIfClosed();
        return is.available();
    
private voidcheckIfClosed()
Check if the underlying InputStream is null. If so throw an Exception

throws
IOException if the underlying InputStream is null

        if (is == null)
            throw new IOException("Stream is closed");
    
public voidclose()
Set the underlying InputStream to null

        is = null;
    
public java.io.InputStreamgetUnderlyingStream()

        return is;
    
public synchronized voidmark(int readlimit)

see
java.io.FilterInputStream#mark(int)

        if (is != null)
            is.mark(readlimit);
    
public booleanmarkSupported()

see
java.io.FilterInputStream#markSupported()

        if (is == null)
            return false;
        return is.markSupported();
    
public intread(byte[] b)

see
java.io.FilterInputStream#read(byte[])

        checkIfClosed();
        return is.read(b);
    
public intread(byte[] b, int off, int len)

see
java.io.FilterInputStream#read(byte[], int, int)

        checkIfClosed();
        return is.read(b, off, len);
    
public intread()

see
java.io.InputStream#read()

        checkIfClosed();
        return is.read();
    
public synchronized voidreset()

see
java.io.FilterInputStream#reset()

        checkIfClosed();
        is.reset();
    
public longskip(long n)

see
java.io.FilterInputStream#skip(long)

        checkIfClosed();
        return is.skip(n);