Package com.squareup.okhttp.internal
Class Platform
java.lang.Object
com.squareup.okhttp.internal.Platform
public final class Platform extends Object
Access to proprietary Android APIs. Doesn't use reflection.
-
Constructor Summary
Constructors Constructor Description Platform() -
Method Summary
Modifier and Type Method Description voidconnectSocket(Socket socket, InetSocketAddress address, int connectTimeout)voidenableTlsExtensions(SSLSocket socket, String uriHost)static Platformget()intgetMtu(Socket socket)Returns the maximum transmission unit of the network interface used bysocket, or a reasonable default if there's an error retrieving it from the socket.byte[]getNpnSelectedProtocol(SSLSocket socket)Returns the negotiated protocol, or null if no protocol was negotiated.StringgetPrefix()Prefix used on custom headers.voidlogW(String warning)OutputStreamnewDeflaterOutputStream(OutputStream out, Deflater deflater, boolean syncFlush)Returns a deflater output stream that supports SYNC_FLUSH for SPDY name value blocks.voidsetNpnProtocols(SSLSocket socket, byte[] npnProtocols)Sets client-supported protocols on a socket to send to a server.voidsupportTlsIntolerantServer(SSLSocket socket)voidtagSocket(Socket socket)URItoUriLenient(URL url)voiduntagSocket(Socket socket)
-
Constructor Details
-
Platform
public Platform()
-
-
Method Details
-
get
-
logW
-
tagSocket
- Throws:
SocketException
-
untagSocket
- Throws:
SocketException
-
toUriLenient
- Throws:
URISyntaxException
-
enableTlsExtensions
-
supportTlsIntolerantServer
-
getNpnSelectedProtocol
Returns the negotiated protocol, or null if no protocol was negotiated. -
setNpnProtocols
Sets client-supported protocols on a socket to send to a server. The protocols are only sent if the socket implementation supports NPN. -
newDeflaterOutputStream
public OutputStream newDeflaterOutputStream(OutputStream out, Deflater deflater, boolean syncFlush)Returns a deflater output stream that supports SYNC_FLUSH for SPDY name value blocks. This throws anUnsupportedOperationExceptionon Java 6 and earlier where there is no built-in API to do SYNC_FLUSH. -
getMtu
Returns the maximum transmission unit of the network interface used bysocket, or a reasonable default if there's an error retrieving it from the socket.The returned value should only be used as an optimization; such as to size buffers efficiently.
-
connectSocket
public void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout) throws IOException- Throws:
IOException
-
getPrefix
Prefix used on custom headers.
-