Class HTTPBuffers

java.lang.Object
io.fusionauth.http.server.internal.HTTPBuffers

public class HTTPBuffers extends Object
A class that lazily creates and caches the buffers for a single worker thread. This is only used by the worker thread, so no synchronization is required.
Author:
Brian Pontarelli
  • Constructor Details

  • Method Details

    • chuckedOutputStream

      public FastByteArrayOutputStream chuckedOutputStream()
      Returns:
      An output stream that can be used for chunking responses. This uses the configuration's HTTPServerConfiguration.getMaxResponseChunkSize() value plus 64 bytes of padding for the header and footer. This is lazily created.
    • chunkBuffer

      public byte[] chunkBuffer()
      Returns:
      A byte array that can be used for chunking responses. This uses the configuration's HTTPServerConfiguration.getMaxResponseChunkSize() value for the size. This is lazily created.
    • requestBuffer

      public byte[] requestBuffer()
      Returns:
      A byte array used to read the request preamble and body. This uses the configuration's HTTPServerConfiguration.getRequestBufferSize() value for the size. It is created in the constructor since it is always needed.
    • responseBuffer

      public byte[] responseBuffer()
      Returns:
      A byte array used to buffer the response such that the server can replace the response with an error response if an error occurs during processing, but after the preamble and body has already been partially written.