org.springframework.mock.web

## Class DelegatingServletInputStream

- java.lang.Object
- - java.io.InputStream
  - - javax.servlet.ServletInputStream
    - - org.springframework.mock.web.DelegatingServletInputStream

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class DelegatingServletInputStream
      extends ServletInputStream

  Delegating implementation of `ServletInputStream`.

  Used by `MockHttpServletRequest`; typically not directly used for testing application controllers.

  Since:
    1.0.2
  Author:
    Juergen Hoeller
  See Also:
    `MockHttpServletRequest`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DelegatingServletInputStream(InputStream sourceStream)` Create a DelegatingServletInputStream for the given source stream.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `InputStream` | `getSourceStream()` Return the underlying source stream (never `null`).
    `int` | `read()`

    - ### Methods inherited from class javax.servlet.ServletInputStream

      `readLine`

    - ### Methods inherited from class java.io.InputStream

      `available, mark, markSupported, read, read, reset, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DelegatingServletInputStream

          public DelegatingServletInputStream(InputStream sourceStream)

      Create a DelegatingServletInputStream for the given source stream.
      Parameters:
        `sourceStream` - the source stream (never `null`)

  - ### Method Detail

    - #### getSourceStream

          public final InputStream getSourceStream()

      Return the underlying source stream (never `null`).

    - #### read

          public int read()
                   throws IOException

      Specified by:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `InputStream`
      Throws:
        `IOException`