|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwjhk.jupload2.upload.helper.HTTPInputStreamReader
public class HTTPInputStreamReader
A helper, to read the response coming from the server.
| Field Summary | |
|---|---|
private byte[] |
body
|
private java.lang.String |
charset
|
private byte[] |
chunkbuf
|
private static int |
CHUNKBUF_SIZE
|
private int |
clen
|
private CookieJar |
cookies
|
private boolean |
gotChunked
|
(package private) boolean |
gotClose
|
private boolean |
gotContentLength
|
private HTTPConnectionHelper |
httpConnectionHelper
|
private int |
httpStatusCode
The server HTTP response. |
private java.lang.String |
line
|
private static java.util.regex.Pattern |
pChunked
|
private static java.util.regex.Pattern |
pClose
|
private static java.util.regex.Pattern |
pContentLen
|
private static java.util.regex.Pattern |
pContentTypeCs
|
private static java.util.regex.Pattern |
pHttpStatus
|
private static java.util.regex.Pattern |
pProxyClose
|
private static java.util.regex.Pattern |
pSetCookie
|
private boolean |
readingHttpBody
|
(package private) java.lang.String |
responseBody
Contains the HTTP response body, that is: the server response, without the headers. |
(package private) java.lang.String |
responseHeaders
The headers of the HTTP response. |
(package private) java.lang.String |
responseMsg
The status message from the first line of the response (e.g. "200 OK"). |
private UploadPolicy |
uploadPolicy
The current upload policy, always useful. |
| Constructor Summary | |
|---|---|
HTTPInputStreamReader(HTTPConnectionHelper httpConnectionHelper,
UploadPolicy uploadPolicy)
The standard constructor: does nothing ! |
|
| Method Summary | |
|---|---|
(package private) static byte[] |
byteAppend(byte[] buf1,
byte[] buf2)
Concatenates two byte arrays. |
(package private) static byte[] |
byteAppend(byte[] buf1,
byte[] buf2,
int len)
Concatenates two byte arrays. |
int |
gethttpStatusCode()
Return the last read http response (200, in case of success). |
java.lang.String |
getResponseBody()
Get the last response body. |
java.lang.String |
getResponseHeaders()
Get the headers of the HTTP response. |
java.lang.String |
getResponseMsg()
Get the last response message. |
int |
readHttpResponse()
The main method: reads the response in the input stream. |
static byte[] |
readLine(java.io.PushbackInputStream inputStream,
boolean includeCR)
Similar like BufferedInputStream#readLine() but operates on raw bytes. |
static java.lang.String |
readLine(java.io.PushbackInputStream inputStream,
java.lang.String charset,
boolean includeCR)
Similar like BufferedInputStream#readLine() but operates on raw bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private UploadPolicy uploadPolicy
private HTTPConnectionHelper httpConnectionHelper
java.lang.String responseBody
java.lang.String responseHeaders
java.lang.String responseMsg
private CookieJar cookies
private boolean readingHttpBody
boolean gotClose
private boolean gotChunked
private boolean gotContentLength
private int clen
private int httpStatusCode
private java.lang.String line
private byte[] body
private java.lang.String charset
private static final int CHUNKBUF_SIZE
private final byte[] chunkbuf
private static final java.util.regex.Pattern pChunked
private static final java.util.regex.Pattern pClose
private static final java.util.regex.Pattern pProxyClose
private static final java.util.regex.Pattern pHttpStatus
private static final java.util.regex.Pattern pContentLen
private static final java.util.regex.Pattern pContentTypeCs
private static final java.util.regex.Pattern pSetCookie
| Constructor Detail |
|---|
public HTTPInputStreamReader(HTTPConnectionHelper httpConnectionHelper,
UploadPolicy uploadPolicy)
httpConnectionHelper - The connection helper, associated with this
instance.uploadPolicy - The current upload policy.| Method Detail |
|---|
public int gethttpStatusCode()
public java.lang.String getResponseBody()
public java.lang.String getResponseHeaders()
public java.lang.String getResponseMsg()
public int readHttpResponse()
throws JUploadException
JUploadException
static byte[] byteAppend(byte[] buf1,
byte[] buf2)
buf1 - The first arraybuf2 - The second array
static byte[] byteAppend(byte[] buf1,
byte[] buf2,
int len)
buf1 - The first arraybuf2 - The second arraylen - Number of bytes to copy from buf2
public static java.lang.String readLine(java.io.PushbackInputStream inputStream,
java.lang.String charset,
boolean includeCR)
throws java.io.IOException
inputStream - charset - The input charset of the stream.includeCR - Set to true, if the terminating CR/LF should be included
in the returned byte array.
java.io.IOException
public static byte[] readLine(java.io.PushbackInputStream inputStream,
boolean includeCR)
throws java.io.IOException
inputStream - includeCR - Set to true, if the terminating CR/LF should be included
in the returned byte array. In this case, CR/LF is always
returned to the caller, whether the input stream got CR, LF or
CRLF.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||