001    package com.mockrunner.mock.web;
002    
003    import java.io.ByteArrayInputStream;
004    import java.io.IOException;
005    
006    import javax.servlet.ServletInputStream;
007    
008    /**
009     * Mock implementation of <code>ServletInputStream</code>.
010     */
011    public class MockServletInputStream extends ServletInputStream
012    {
013        private ByteArrayInputStream stream;
014        
015        public MockServletInputStream(byte[] data)
016        {
017            stream = new ByteArrayInputStream(data);
018        }
019            
020        public int read() throws IOException
021        {
022            return stream.read();
023        }
024    }