public class Platform extends Object
DeflaterOutputStream
that is
public API in Java 7 and callable via reflection in Android 4.1+.Constructor and Description |
---|
Platform() |
Modifier and Type | Method and Description |
---|---|
void |
connectSocket(Socket socket,
InetSocketAddress address,
int connectTimeout) |
void |
enableTlsExtensions(SSLSocket socket,
String uriHost)
Attempt a TLS connection with useful extensions enabled.
|
static Platform |
get() |
int |
getMtu(Socket socket)
Returns the maximum transmission unit of the network interface used by
socket , or a reasonable default if this platform doesn't expose the
MTU to the application layer. |
byte[] |
getNpnSelectedProtocol(SSLSocket socket)
Returns the negotiated protocol, or null if no protocol was negotiated.
|
String |
getPrefix()
Prefix used on custom headers.
|
void |
logW(String warning) |
OutputStream |
newDeflaterOutputStream(OutputStream out,
Deflater deflater,
boolean syncFlush)
Returns a deflater output stream that supports SYNC_FLUSH for SPDY name
value blocks.
|
void |
setNpnProtocols(SSLSocket socket,
byte[] npnProtocols)
Sets client-supported protocols on a socket to send to a server.
|
void |
supportTlsIntolerantServer(SSLSocket socket)
Attempt a secure connection with basic functionality to maximize
compatibility.
|
void |
tagSocket(Socket socket) |
URI |
toUriLenient(URL url) |
void |
untagSocket(Socket socket) |
public static Platform get()
public String getPrefix()
public void logW(String warning)
public void tagSocket(Socket socket) throws SocketException
SocketException
public void untagSocket(Socket socket) throws SocketException
SocketException
public URI toUriLenient(URL url) throws URISyntaxException
URISyntaxException
public void enableTlsExtensions(SSLSocket socket, String uriHost)
public void supportTlsIntolerantServer(SSLSocket socket)
public byte[] getNpnSelectedProtocol(SSLSocket socket)
public void setNpnProtocols(SSLSocket socket, byte[] npnProtocols)
public void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout) throws IOException
IOException
public OutputStream newDeflaterOutputStream(OutputStream out, Deflater deflater, boolean syncFlush)
UnsupportedOperationException
on
Java 6 and earlier where there is no built-in API to do SYNC_FLUSH.public int getMtu(Socket socket) throws IOException
socket
, or a reasonable default if this platform doesn't expose the
MTU to the application layer.
The returned value should only be used as an optimization; such as to size buffers efficiently.
IOException
Copyright © 2014. All rights reserved.