Class HTTPOutputStream

java.lang.Object
java.io.OutputStream
io.fusionauth.http.server.io.HTTPOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class HTTPOutputStream extends OutputStream
The primary output stream for the HTTP server (currently supporting version 1.1). This handles delegating to compression and chunking output streams, depending on the response headers the application set.
Author:
Brian Pontarelli
  • Constructor Details

  • Method Details

    • close

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

      public void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException
    • forceFlush

      public void forceFlush() throws IOException
      Calls the HTTPOutputStream.ServerToSocketOutputStream.forceFlush() method to write all buffered bytes to the socket. This also writes the preamble to the buffer or to the socket if it hasn't been written yet.
      Throws:
      IOException - If the socket throws.
    • isCommitted

      public boolean isCommitted()
      Returns:
      True if at least one byte was written back to the client. False if the response has not been generated or is sitting in the response buffer.
    • isCompress

      public boolean isCompress()
    • setCompress

      public void setCompress(boolean compress)
    • reset

      public void reset()
    • willCompress

      public boolean willCompress()
      Returns:
      true if compression has been requested, and it appears as though we will compress because the requested content encoding is supported.
    • write

      public void write(byte[] buffer, int offset, int length) throws IOException
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(int b) throws IOException
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b) throws IOException
      Overrides:
      write in class OutputStream
      Throws:
      IOException