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 Details

    • Platform

      public Platform()
  • Method Details

    • get

      public static Platform get()
    • logW

      public void logW​(String warning)
    • tagSocket

      public void tagSocket​(Socket socket) throws SocketException
      Throws:
      SocketException
    • untagSocket

      public void untagSocket​(Socket socket) throws SocketException
      Throws:
      SocketException
    • toUriLenient

      public URI toUriLenient​(URL url) throws URISyntaxException
      Throws:
      URISyntaxException
    • enableTlsExtensions

      public void enableTlsExtensions​(SSLSocket socket, String uriHost)
    • supportTlsIntolerantServer

      public void supportTlsIntolerantServer​(SSLSocket socket)
    • getNpnSelectedProtocol

      public byte[] getNpnSelectedProtocol​(SSLSocket socket)
      Returns the negotiated protocol, or null if no protocol was negotiated.
    • setNpnProtocols

      public void setNpnProtocols​(SSLSocket socket, byte[] npnProtocols)
      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 an UnsupportedOperationException on Java 6 and earlier where there is no built-in API to do SYNC_FLUSH.
    • getMtu

      public int getMtu​(Socket socket)
      Returns the maximum transmission unit of the network interface used by socket, 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

      public String getPrefix()
      Prefix used on custom headers.