Package org.springframework.mock.web

# 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 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
Description
`DelegatingServletInputStream(InputStream sourceStream)`
Create a DelegatingServletInputStream for the given source stream.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`close()`
`final InputStream`
`getSourceStream()`
Return the underlying source stream (never `null`).
`boolean`
`isFinished()`
`boolean`
`isReady()`
`int`
`read()`
`void`
`setReadListener(ReadListener readListener)`

### Methods inherited from class jakarta.servlet.ServletInputStream

`readLine`

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

`mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo`

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

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

## 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 `ServletInputStream`

### isReady

public boolean isReady()

Specified by:
  `isReady` in class `ServletInputStream`

### setReadListener

public void setReadListener(ReadListener readListener)

Specified by:
  `setReadListener` in class `ServletInputStream`