net.i2p.i2ptunnel
Class HTTPResponseOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.i2p.i2ptunnel.HTTPResponseOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
class HTTPResponseOutputStream
- extends java.io.FilterOutputStream
Simple stream for delivering an HTTP response to
the client, trivially filtered to make sure "Connection: close"
is always in the response. Perhaps add transparent handling of the
Content-encoding: x-i2p-gzip, adjusting the headers to say Content-encoding: identity?
Content-encoding: gzip is trivial as well, but Transfer-encoding: chunked makes it
more work than is worthwhile at the moment.
Fields inherited from class java.io.FilterOutputStream |
out |
Methods inherited from class java.io.FilterOutputStream |
flush |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_headerBuffer
protected ByteArray _headerBuffer
_gzip
protected boolean _gzip
HTTPResponseOutputStream
public HTTPResponseOutputStream(java.io.OutputStream raw)
write
public void write(int c)
throws java.io.IOException
- Overrides:
write
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
write
public void write(byte[] buf)
throws java.io.IOException
- Overrides:
write
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
write
public void write(byte[] buf,
int off,
int len)
throws java.io.IOException
- Overrides:
write
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
filterResponseLine
protected java.lang.String filterResponseLine(java.lang.String line)
- Tweak that first HTTP response line (HTTP 200 OK, etc)
shouldCompress
protected boolean shouldCompress()
finishHeaders
protected void finishHeaders()
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
beginProcessing
protected void beginProcessing()
throws java.io.IOException
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
main
public static void main(java.lang.String[] args)