View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.servlet;
8   
9   import java.io.ByteArrayInputStream;
10  import java.io.IOException;
11  import java.io.InputStream;
12  
13  import javax.servlet.ServletInputStream;
14  
15  public class MockServletInputStream extends ServletInputStream
16  {
17      private InputStream input;
18  
19      public MockServletInputStream(InputStream dataStream)
20      {
21          super();
22          input = dataStream;
23      }
24  
25      public MockServletInputStream()
26      {
27          this(new ByteArrayInputStream(new byte[0]));
28      }
29  
30      @Override
31      public int read() throws IOException
32      {
33          return input.read();
34      }
35  }
36