Class HttpTransport
java.lang.Object
com.squareup.okhttp.internal.http.HttpTransport
public final class HttpTransport extends Object
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CHUNK_LENGTH -
Constructor Summary
Constructors Constructor Description HttpTransport(HttpEngine httpEngine, OutputStream outputStream, InputStream inputStream) -
Method Summary
Modifier and Type Method Description OutputStreamcreateRequestBody()voidflushRequest()InputStreamgetTransferStream(CacheRequest cacheRequest)booleanmakeReusable(boolean streamCancelled, OutputStream requestBodyOut, InputStream responseBodyIn)ResponseHeadersreadResponseHeaders()voidwriteRequestBody(com.squareup.okhttp.internal.http.RetryableOutputStream requestBody)voidwriteRequestHeaders()Prepares the HTTP headers and sends them to the server.
-
Field Details
-
DEFAULT_CHUNK_LENGTH
public static final int DEFAULT_CHUNK_LENGTH- See Also:
- Constant Field Values
-
-
Constructor Details
-
HttpTransport
-
-
Method Details
-
createRequestBody
- Throws:
IOException
-
flushRequest
- Throws:
IOException
-
writeRequestBody
public void writeRequestBody(com.squareup.okhttp.internal.http.RetryableOutputStream requestBody) throws IOException- Throws:
IOException
-
writeRequestHeaders
Prepares the HTTP headers and sends them to the server.For streaming requests with a body, headers must be prepared before the output stream has been written to. Otherwise the body would need to be buffered!
For non-streaming requests with a body, headers must be prepared after the output stream has been written to and closed. This ensures that the
Content-Lengthheader field receives the proper value.- Throws:
IOException
-
readResponseHeaders
- Throws:
IOException
-
makeReusable
public boolean makeReusable(boolean streamCancelled, OutputStream requestBodyOut, InputStream responseBodyIn) -
getTransferStream
- Throws:
IOException
-