|
|||||||||
| Home >> All >> [ HTTPClient overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
HTTPClient
Class RespInputStream

java.lang.Objectjava.io.InputStream
HTTPClient.RespInputStream
- All Implemented Interfaces:
- GlobalConstants
- final class RespInputStream
- extends java.io.InputStream
- implements GlobalConstants
- extends java.io.InputStream
This is the InputStream that gets returned to the user. The extensions consist of the capability to have the data pushed into a buffer if the stream demux needs to.
- Since:
- V0.2
- Version:
- 0.3-2 18/06/1999
| Field Summary | |
private byte[] |
buffer
this buffer is used to buffer data that the demux has to get rid of |
static int |
CD_0
|
static int |
CD_CHUNKED
|
static int |
CD_CLOSE
|
static int |
CD_CONTLEN
|
static int |
CD_HDRS
|
static int |
CD_MP_BR
|
static int |
CD_NONE
Content delimiters |
private byte[] |
ch
|
(package private) boolean |
closed
signals that the user has closed the stream and will therefore not read any further data |
(package private) int |
count
the total number of bytes of entity data read from the demux so far |
static boolean |
DebugAll
Debug variables |
static boolean |
DebugAuth
|
static boolean |
DebugConn
|
static boolean |
DebugDemux
|
static boolean |
DebugMods
|
static boolean |
DebugResp
|
static boolean |
DebugSocks
|
static boolean |
DebugURLC
|
private StreamDemultiplexor |
demux
the stream demultiplexor |
private boolean |
dont_truncate
signals that the connection may not be closed prematurely |
private int |
end
the end of the data in the buffer |
static int |
HTTP
possible http protocols we (might) handle |
static int |
HTTP_1_0
some known http versions |
static int |
HTTP_1_1
|
static int |
HTTP_NG
|
static int |
HTTPS
|
private boolean |
interrupted
signals that we were interrupted and that the buffer is not complete |
private int |
offset
the offset at which the unread data starts in the buffer |
private ResponseHandler |
resph
our response handler |
static int |
SHTTP
|
| Constructor Summary | |
(package private) |
RespInputStream(StreamDemultiplexor demux,
ResponseHandler resph)
|
| Method Summary | |
int |
available()
gets the number of bytes available for reading without blocking. |
void |
close()
closes the stream. |
(package private) void |
dontTruncate()
Sometime the full response body must be read, i.e. |
protected void |
finalize()
A safety net to clean up. |
int |
read()
Reads a single byte. |
int |
read(byte[] b,
int off,
int len)
Reads len bytes into b, starting at offset off. |
(package private) void |
readAll(int timeout)
Reads all remainings data into buffer. |
long |
skip(long num)
skips num bytes. |
| Methods inherited from class java.io.InputStream |
mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
demux
private StreamDemultiplexor demux
- the stream demultiplexor
resph
private ResponseHandler resph
- our response handler
closed
boolean closed
- signals that the user has closed the stream and will therefore
not read any further data
dont_truncate
private boolean dont_truncate
- signals that the connection may not be closed prematurely
buffer
private byte[] buffer
- this buffer is used to buffer data that the demux has to get rid of
interrupted
private boolean interrupted
- signals that we were interrupted and that the buffer is not complete
offset
private int offset
- the offset at which the unread data starts in the buffer
end
private int end
- the end of the data in the buffer
count
int count
- the total number of bytes of entity data read from the demux so far
ch
private byte[] ch
DebugAll
public static final boolean DebugAll
- Debug variables
- See Also:
- Constant Field Values
DebugConn
public static final boolean DebugConn
- See Also:
- Constant Field Values
DebugResp
public static final boolean DebugResp
- See Also:
- Constant Field Values
DebugDemux
public static final boolean DebugDemux
- See Also:
- Constant Field Values
DebugAuth
public static final boolean DebugAuth
- See Also:
- Constant Field Values
DebugSocks
public static final boolean DebugSocks
- See Also:
- Constant Field Values
DebugMods
public static final boolean DebugMods
- See Also:
- Constant Field Values
DebugURLC
public static final boolean DebugURLC
- See Also:
- Constant Field Values
HTTP
public static final int HTTP
- possible http protocols we (might) handle
- See Also:
- Constant Field Values
HTTPS
public static final int HTTPS
- See Also:
- Constant Field Values
SHTTP
public static final int SHTTP
- See Also:
- Constant Field Values
HTTP_NG
public static final int HTTP_NG
- See Also:
- Constant Field Values
HTTP_1_0
public static final int HTTP_1_0
- some known http versions
- See Also:
- Constant Field Values
HTTP_1_1
public static final int HTTP_1_1
- See Also:
- Constant Field Values
CD_NONE
public static final int CD_NONE
- Content delimiters
- See Also:
- Constant Field Values
CD_HDRS
public static final int CD_HDRS
- See Also:
- Constant Field Values
CD_0
public static final int CD_0
- See Also:
- Constant Field Values
CD_CLOSE
public static final int CD_CLOSE
- See Also:
- Constant Field Values
CD_CONTLEN
public static final int CD_CONTLEN
- See Also:
- Constant Field Values
CD_CHUNKED
public static final int CD_CHUNKED
- See Also:
- Constant Field Values
CD_MP_BR
public static final int CD_MP_BR
- See Also:
- Constant Field Values
| Constructor Detail |
RespInputStream
RespInputStream(StreamDemultiplexor demux, ResponseHandler resph)
| Method Detail |
read
public int read()
throws java.io.IOException
- Reads a single byte.
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Reads len bytes into b, starting at offset
off.
skip
public long skip(long num)
throws java.io.IOException
- skips num bytes.
available
public int available()
throws java.io.IOException
- gets the number of bytes available for reading without blocking.
close
public void close()
throws java.io.IOException
- closes the stream.
finalize
protected void finalize()
throws java.lang.Throwable
- A safety net to clean up.
readAll
void readAll(int timeout)
throws java.io.IOException
- Reads all remainings data into buffer. This is used to force a read
of upstream responses.
This is probably the most tricky and buggy method around. It's the only one that really violates the strict top-down method invocation from the Response through the ResponseStream to the StreamDemultiplexor. This means we need to be awfully careful about what is synchronized and what parameters are passed to whom.
dontTruncate
void dontTruncate()
- Sometime the full response body must be read, i.e. the connection may
not be closed prematurely (by us). Currently this is needed when the
chunked encoding with trailers is used in a response.
|
|||||||||
| Home >> All >> [ HTTPClient overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC