Class FramedTransport
- java.lang.Object
-
- com.squareup.okhttp.internal.http.FramedTransport
-
-
Field Summary
-
Fields inherited from interface com.squareup.okhttp.internal.http.Transport
DISCARD_STREAM_TIMEOUT_MILLIS
-
-
Constructor Summary
Constructors Constructor Description FramedTransport(HttpEngine httpEngine, FramedConnection framedConnection)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanReuseConnection()Returns true if the socket connection held by this transport can be reused for a follow-up exchange.SinkcreateRequestBody(Request request, long contentLength)Returns an output stream where the request body can be streamed.voiddisconnect(HttpEngine engine)voidfinishRequest()Flush the request to the underlying socket.ResponseBodyopenResponseBody(Response response)Returns a stream that reads the response body.static Response.BuilderreadNameValueBlock(List<Header> headerBlock, Protocol protocol)Returns headers for a name value block containing a SPDY response.Response.BuilderreadResponseHeaders()Read and return response headers.voidreleaseConnectionOnIdle()Configures the response body to pool or close the socket connection when the response body is closed.static List<Header>writeNameValueBlock(Request request, Protocol protocol, String version)Returns a list of alternating names and values containing a SPDY request.voidwriteRequestBody(RetryableSink requestBody)Sends the request body returned byTransport.createRequestBody(com.squareup.okhttp.Request, long)to the remote peer.voidwriteRequestHeaders(Request request)This should update the HTTP engine's sentRequestMillis field.
-
-
-
Constructor Detail
-
FramedTransport
public FramedTransport(HttpEngine httpEngine, FramedConnection framedConnection)
-
-
Method Detail
-
createRequestBody
public Sink createRequestBody(Request request, long contentLength) throws IOException
Description copied from interface:TransportReturns an output stream where the request body can be streamed.- Specified by:
createRequestBodyin interfaceTransport- Throws:
IOException
-
writeRequestHeaders
public void writeRequestHeaders(Request request) throws IOException
Description copied from interface:TransportThis should update the HTTP engine's sentRequestMillis field.- Specified by:
writeRequestHeadersin interfaceTransport- Throws:
IOException
-
writeRequestBody
public void writeRequestBody(RetryableSink requestBody) throws IOException
Description copied from interface:TransportSends the request body returned byTransport.createRequestBody(com.squareup.okhttp.Request, long)to the remote peer.- Specified by:
writeRequestBodyin interfaceTransport- Throws:
IOException
-
finishRequest
public void finishRequest() throws IOExceptionDescription copied from interface:TransportFlush the request to the underlying socket.- Specified by:
finishRequestin interfaceTransport- Throws:
IOException
-
readResponseHeaders
public Response.Builder readResponseHeaders() throws IOException
Description copied from interface:TransportRead and return response headers.- Specified by:
readResponseHeadersin interfaceTransport- Throws:
IOException
-
writeNameValueBlock
public static List<Header> writeNameValueBlock(Request request, Protocol protocol, String version)
Returns a list of alternating names and values containing a SPDY request. Names are all lowercase. No names are repeated. If any name has multiple values, they are concatenated using "\0" as a delimiter.
-
readNameValueBlock
public static Response.Builder readNameValueBlock(List<Header> headerBlock, Protocol protocol) throws IOException
Returns headers for a name value block containing a SPDY response.- Throws:
IOException
-
openResponseBody
public ResponseBody openResponseBody(Response response) throws IOException
Description copied from interface:TransportReturns a stream that reads the response body.- Specified by:
openResponseBodyin interfaceTransport- Throws:
IOException
-
releaseConnectionOnIdle
public void releaseConnectionOnIdle()
Description copied from interface:TransportConfigures the response body to pool or close the socket connection when the response body is closed.- Specified by:
releaseConnectionOnIdlein interfaceTransport
-
disconnect
public void disconnect(HttpEngine engine) throws IOException
- Specified by:
disconnectin interfaceTransport- Throws:
IOException
-
canReuseConnection
public boolean canReuseConnection()
Description copied from interface:TransportReturns true if the socket connection held by this transport can be reused for a follow-up exchange.- Specified by:
canReuseConnectionin interfaceTransport
-
-