public interface HttpConnection
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection and frees all the allocated resources.
|
byte[] |
getServerResponseBody()
Gets the server response body.
|
int |
getServerResponseCode()
Gets the HTTP response code from the server.
|
void |
setHeaders(List<NameValue> requestHeaders,
boolean isFixedLengthStreamingMode,
long totalBodyBytes)
Set request headers.
|
void |
writeBody(byte[] bytes)
Write a byte array into the request body.
|
void |
writeBody(byte[] bytes,
int lengthToWriteFromStart)
Write a portion of a byte array into the request body.
|
void setHeaders(List<NameValue> requestHeaders, boolean isFixedLengthStreamingMode, long totalBodyBytes) throws IOException
requestHeaders
- request headers to setisFixedLengthStreamingMode
- true if the fixed length streaming mode must be used. If
it's false, chunked streaming mode has to be usedtotalBodyBytes
- total number of bytesIOException
- if an error occurs while setting request headersvoid writeBody(byte[] bytes) throws IOException
bytes
- array with the bytes to writeIOException
- if an error occurs while writingvoid writeBody(byte[] bytes, int lengthToWriteFromStart) throws IOException
bytes
- array with the bytes to writelengthToWriteFromStart
- how many bytes to write, starting from the first one in
the arrayIOException
- if an error occurs while writingint getServerResponseCode() throws IOException
IOException
- if an error occurs while getting the server response codebyte[] getServerResponseBody() throws IOException
IOException
- if an error occurs while getting the server response bodyvoid close()