ReadListener (Servlet 6.0 API Documentation - Apache Tomcat 10.1.48)
Description: declaration: package: jakarta.servlet, interface: ReadListener

# Interface ReadListener

All Superinterfaces:
  `EventListener`

public interface ReadListener extends EventListener
Receives notification of read events when using non-blocking IO.

Since:
  Servlet 3.1

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAllDataRead()`
  Invoked when the request body has been fully read.
  `void`
  `onDataAvailable()`
  Invoked when data is available to read.
  `void`
  `onError(Throwable throwable)`
  Invoked if an error occurs while reading the request body.

- ## Method Details

  - ### onDataAvailable

    void onDataAvailable() throws IOException
    Invoked when data is available to read. The container will invoke this method the first time for a request as soon as there is data to read. Subsequent invocations will only occur if a call to `ServletInputStream.isReady()` has returned false and data has subsequently become available to read.
    Throws:
      `IOException` - id an I/O error occurs while processing the event

  - ### onAllDataRead

    void onAllDataRead() throws IOException
    Invoked when the request body has been fully read.
    Throws:
      `IOException` - id an I/O error occurs while processing the event

  - ### onError

    void onError(Throwable throwable)
    Invoked if an error occurs while reading the request body.
    Parameters:
      `throwable` - The exception that occurred