001package com.identityworksllc.iiq.common;
002
003import java.io.IOException;
004import java.io.InputStream;
005
006/**
007 * An input stream primarily for testing purposes that always contains the given
008 * number of zeroes.
009 */
010public class NullInputStream extends InputStream {
011    private int size;
012
013    public NullInputStream() {
014        this(0);
015    }
016
017    public NullInputStream(int size) {
018        this.size = size;
019    }
020
021    @Override
022    public int read() throws IOException {
023        if (size-- > 0) {
024            return 0;
025        }
026        return -1;
027    }
028}