java.lang.Object
net.i2p.i2ptunnel.I2PTunnelHTTPClient.InputReader
- Enclosing class:
I2PTunnelHTTPClient
Read the first line unbuffered, then subsequent lines. We can't use a BufferedReader for POST because we can't have readahead, since we are passing the stream on to I2PTunnelRunner for the POST data.
Warning - DataHelper limits line length.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Public MethodsModifier and TypeMethodDescriptionvoiddrain()Read the rest of the headers, which keeps firefox from complaining about connection reset after an error on the first line.(package private) booleanpeerClosed(Socket sock) Probe whether the peer closed during a long wait.(package private) StringreadLine()Reads one CRLF-terminated line.
Field Details
_s
InputStream _sStream the status line is read from.
Constructor Details
InputReader
Reads the proxy response until the socket closes.- Parameters:
s- the input stream to wrap
Method Details
readLine
Reads one CRLF-terminated line.- Returns:
- the line without the terminator
- Throws:
IOException- if the stream fails or ends early
peerClosed
Probe whether the peer closed during a long wait. A timed read returns -1 on FIN (peer closed), times out when still open, or yields a pipelined byte which is pushed back so it is not lost.- Parameters:
sock- the peer-facing socket (used only for SO_TIMEOUT)- Returns:
- true if the peer has closed (or the stream is unusable)
drain
public void drain()Read the rest of the headers, which keeps firefox from complaining about connection reset after an error on the first line.