Package com.squareup.okhttp.internal.huc
Class JavaApiConverter
- java.lang.Object
-
- com.squareup.okhttp.internal.huc.JavaApiConverter
-
public final class JavaApiConverter extends Object
Helper methods that convert between Java and OkHttp representations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CacheRequestcreateJavaCacheRequest(CacheRequest okCacheRequest)static CacheResponsecreateJavaCacheResponse(Response response)Creates aCacheResponseof the correct (sub)type using information gathered from the suppliedResponse.static RequestcreateOkRequest(URI uri, String requestMethod, Map<String,List<String>> requestHeaders)Creates an OkHttpRequestfrom the supplied information.static ResponsecreateOkResponseForCachePut(URI uri, URLConnection urlConnection)
-
-
-
Method Detail
-
createOkResponseForCachePut
public static Response createOkResponseForCachePut(URI uri, URLConnection urlConnection) throws IOException
Creates an OkHttpResponseusing the suppliedURIandURLConnectionto supply the data. The URLConnection is assumed to already be connected. If this method returnsnullthe response is uncacheable.- Throws:
IOException
-
createOkRequest
public static Request createOkRequest(URI uri, String requestMethod, Map<String,List<String>> requestHeaders)
Creates an OkHttpRequestfrom the supplied information.This method allows a
nullvalue forrequestHeadersfor situations where a connection is already connected and access to the headers has been lost. SeeURLConnection.getRequestProperties()for details.
-
createJavaCacheResponse
public static CacheResponse createJavaCacheResponse(Response response)
Creates aCacheResponseof the correct (sub)type using information gathered from the suppliedResponse.
-
createJavaCacheRequest
public static CacheRequest createJavaCacheRequest(CacheRequest okCacheRequest)
-
-