org.apache.coyote.http11.filters

## Class BufferedInputFilter

- java.lang.Object
- - org.apache.coyote.http11.filters.BufferedInputFilter

- All Implemented Interfaces:
    InputFilter, InputBuffer

      public class BufferedInputFilter
      extends Object
      implements InputFilter

  Input filter responsible for reading and buffering the request body, so that it does not interfere with client SSL handshake messages.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferedInputFilter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()` Amount of bytes still available in a buffer.
    `int` | `doRead(ByteChunk chunk, Request request)` Fills the given ByteChunk with the buffered request body.
    `long` | `end()` End the current request.
    `ByteChunk` | `getEncodingName()` Get the name of the encoding handled by this filter.
    `void` | `recycle()` Make the filter ready to process the next request.
    `void` | `setBuffer(InputBuffer buffer)` Set the next buffer in the filter pipeline.
    `void` | `setLimit(int limit)` Set the buffering limit.
    `void` | `setRequest(Request request)` Reads the request body and buffers it.

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

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

- - ### Constructor Detail

    - #### BufferedInputFilter

          public BufferedInputFilter()

  - ### Method Detail

    - #### setLimit

          public void setLimit(int limit)

      Set the buffering limit. This should be reset every time the buffer is used.
      Parameters:
        `limit` - The maximum number of bytes that will be buffered

    - #### setRequest

          public void setRequest(Request request)

      Reads the request body and buffers it.
      Specified by:
        `setRequest` in interface `InputFilter`

    - #### doRead

          public int doRead(ByteChunk chunk,
                   Request request)
                     throws IOException

      Fills the given ByteChunk with the buffered request body.
      Specified by:
        `doRead` in interface `InputFilter`
      Specified by:
        `doRead` in interface `InputBuffer`
      Returns:
        Number of bytes read.
      Throws:
        `IOException`

    - #### setBuffer

          public void setBuffer(InputBuffer buffer)

      Description copied from interface: `InputFilter`
      Set the next buffer in the filter pipeline.
      Specified by:
        `setBuffer` in interface `InputFilter`

    - #### recycle

          public void recycle()

      Description copied from interface: `InputFilter`
      Make the filter ready to process the next request.
      Specified by:
        `recycle` in interface `InputFilter`

    - #### getEncodingName

          public ByteChunk getEncodingName()

      Description copied from interface: `InputFilter`
      Get the name of the encoding handled by this filter.
      Specified by:
        `getEncodingName` in interface `InputFilter`

    - #### end

          public long end()
                   throws IOException

      Description copied from interface: `InputFilter`
      End the current request.
      Specified by:
        `end` in interface `InputFilter`
      Returns:
        0 is the expected return value. A positive value indicates that too many bytes were read. This method is allowed to use buffer.doRead to consume extra bytes. The result of this method can't be negative (if an error happens, an IOException should be thrown instead).
      Throws:
        `IOException`

    - #### available

          public int available()

      Description copied from interface: `InputFilter`
      Amount of bytes still available in a buffer.
      Specified by:
        `available` in interface `InputFilter`

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.