class HTTPResponseOutputStream extends FilterOutputStream
Modifier and Type | Field and Description |
---|---|
protected String |
_contentEncoding
lower-case, trimmed
|
protected String |
_contentType
lower-case, trimmed
|
protected long |
_dataExpected |
protected boolean |
_gzip |
protected ByteArray |
_headerBuffer |
protected boolean |
_keepAliveIn |
protected boolean |
_keepAliveOut |
out
Constructor and Description |
---|
HTTPResponseOutputStream(OutputStream raw) |
HTTPResponseOutputStream(OutputStream raw,
boolean allowKeepAliveIn,
boolean allowKeepAliveOut,
boolean isHead,
LimitOutputStream.DoneCallback cb)
Optionally keep sockets alive and call callback when we're done.
|
Modifier and Type | Method and Description |
---|---|
protected void |
beginProcessing() |
void |
close() |
protected String |
filterResponseLine(String line)
Possibly tweak that first HTTP response line (HTTP/1.0 200 OK, etc).
|
protected void |
finishHeaders() |
boolean |
getKeepAliveIn()
Should we keep the input stream alive when done?
|
boolean |
getKeepAliveOut()
Should we keep the output stream alive when done?
Only supported for the browser socket side.
|
protected boolean |
shouldCompress() |
void |
write(byte[] buf,
int off,
int len) |
void |
write(int c) |
flush, write
protected ByteArray _headerBuffer
protected boolean _gzip
protected long _dataExpected
protected boolean _keepAliveIn
protected boolean _keepAliveOut
protected String _contentType
protected String _contentEncoding
public HTTPResponseOutputStream(OutputStream raw)
public HTTPResponseOutputStream(OutputStream raw, boolean allowKeepAliveIn, boolean allowKeepAliveOut, boolean isHead, LimitOutputStream.DoneCallback cb)
allowKeepAliveIn
- We may, but are not required to, keep the input socket alive.
This is the server on the server side and I2P on the client side.allowKeepAliveOut
- We may, but are not required to, keep the output socket alive.
This is I2P on the server side and the browser on the client side.isHead
- is this a response to a HEAD, and thus no data is expected (RFC 2616 sec. 4.4)cb
- non-null if allowKeepAlive is truepublic boolean getKeepAliveIn()
public boolean getKeepAliveOut()
public void write(int c) throws IOException
write
in class FilterOutputStream
IOException
public void write(byte[] buf, int off, int len) throws IOException
write
in class FilterOutputStream
IOException
protected String filterResponseLine(String line)
protected boolean shouldCompress()
protected void finishHeaders() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
protected void beginProcessing() throws IOException
IOException