Package io.fusionauth.http.server.io
Class HTTPOutputStream
java.lang.Object
java.io.OutputStream
io.fusionauth.http.server.io.HTTPOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
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 Summary
ConstructorsConstructorDescriptionHTTPOutputStream(HTTPServerConfiguration configuration, List<String> acceptEncodings, HTTPResponse response, OutputStream delegate, HTTPBuffers buffers, Runnable writeObserver) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidCalls theHTTPOutputStream.ServerToSocketOutputStream.forceFlush()method to write all buffered bytes to the socket.booleanbooleanvoidreset()voidsetCompress(boolean compress) booleanvoidwrite(byte[] b) voidwrite(byte[] buffer, int offset, int length) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
HTTPOutputStream
public HTTPOutputStream(HTTPServerConfiguration configuration, List<String> acceptEncodings, HTTPResponse response, OutputStream delegate, HTTPBuffers buffers, Runnable writeObserver)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
forceFlush
Calls theHTTPOutputStream.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
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-