Class DelegatingServletInputStream

java.lang.Object
java.io.InputStream
jakarta.servlet.ServletInputStream
org.springframework.mock.web.DelegatingServletInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class DelegatingServletInputStream extends jakarta.servlet.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:
  • Constructor Details

    • DelegatingServletInputStream

      public DelegatingServletInputStream(InputStream sourceStream)
      Create a DelegatingServletInputStream for the given source stream.
      Parameters:
      sourceStream - the source stream (never null)
  • Method Details

    • 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
    • available

      public int available() throws IOException
      Overrides:
      available in class InputStream
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException
    • isFinished

      public boolean isFinished()
      Specified by:
      isFinished in class jakarta.servlet.ServletInputStream
    • isReady

      public boolean isReady()
      Specified by:
      isReady in class jakarta.servlet.ServletInputStream
    • setReadListener

      public void setReadListener(jakarta.servlet.ReadListener readListener)
      Specified by:
      setReadListener in class jakarta.servlet.ServletInputStream