FileDocCategorySizeDatePackage
BrokenInputStream.javaAPI DocAndroid 1.5 API1405Wed May 06 22:41:06 BST 2009tests.api.org.xml.sax.support

BrokenInputStream

public class BrokenInputStream extends InputStream
Implements an InputStream what wraps another InputStream and throws an IOException after having read a specified number of bytes. Used for injecting IOExceptions on lower levels.

Fields Summary
private InputStream
stream
private int
offset
Constructors Summary
public BrokenInputStream(InputStream stream, int offset)

        super();
        
        this.stream = stream;
        this.offset = offset;
    
Methods Summary
public intread()

        if (offset == 0) {
            throw new IOException("Injected exception");
        }

        offset--;
        return stream.read();