当前位置: 首页>>代码示例>>Java>>正文


Java Util.immutableList方法代码示例

本文整理汇总了Java中com.squareup.okhttp.internal.Util.immutableList方法的典型用法代码示例。如果您正苦于以下问题:Java Util.immutableList方法的具体用法?Java Util.immutableList怎么用?Java Util.immutableList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.squareup.okhttp.internal.Util的用法示例。


在下文中一共展示了Util.immutableList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public static Handshake get(SSLSession session) {
    String cipherSuite = session.getCipherSuite();
    if (cipherSuite == null) {
        throw new IllegalStateException("cipherSuite == null");
    }
    Certificate[] peerCertificates;
    List<Certificate> peerCertificatesList;
    List<Certificate> localCertificatesList;
    try {
        peerCertificates = session.getPeerCertificates();
    } catch (SSLPeerUnverifiedException e) {
        peerCertificates = null;
    }
    if (peerCertificates != null) {
        peerCertificatesList = Util.immutableList(peerCertificates);
    } else {
        peerCertificatesList = Collections.emptyList();
    }
    Certificate[] localCertificates = session.getLocalCertificates();
    if (localCertificates != null) {
        localCertificatesList = Util.immutableList(localCertificates);
    } else {
        localCertificatesList = Collections.emptyList();
    }
    return new Handshake(cipherSuite, peerCertificatesList, localCertificatesList);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:Handshake.java

示例2: setProtocols

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public OkHttpClient setProtocols(List<Protocol> protocols) {
    List protocols2 = Util.immutableList((List) protocols);
    if (!protocols2.contains(Protocol.HTTP_1_1)) {
        throw new IllegalArgumentException("protocols doesn't contain http/1.1: " + protocols2);
    } else if (protocols2.contains(Protocol.HTTP_1_0)) {
        throw new IllegalArgumentException("protocols must not contain http/1.0: " +
                protocols2);
    } else if (protocols2.contains(null)) {
        throw new IllegalArgumentException("protocols must not contain null");
    } else {
        this.protocols = Util.immutableList(protocols2);
        return this;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:OkHttpClient.java

示例3: if

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public MultipartBuilder$MultipartRequestBody(MediaType type, ByteString boundary,
                                             List<Headers> partHeaders, List<RequestBody>
                                                     partBodies) {
    if (type == null) {
        throw new NullPointerException("type == null");
    }
    this.boundary = boundary;
    this.contentType = MediaType.parse(type + "; boundary=" + boundary.utf8());
    this.partHeaders = Util.immutableList(partHeaders);
    this.partBodies = Util.immutableList(partBodies);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:MultipartBuilder$MultipartRequestBody.java

示例4: Address

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public Address(String uriHost, int uriPort, Dns dns, SocketFactory socketFactory,
               SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier,
               CertificatePinner certificatePinner, Authenticator authenticator, Proxy proxy,
               List<Protocol> protocols, List<ConnectionSpec> connectionSpecs, ProxySelector
                       proxySelector) {
    this.url = new Builder().scheme(sslSocketFactory != null ? b.a : "http").host(uriHost)
            .port(uriPort).build();
    if (dns == null) {
        throw new IllegalArgumentException("dns == null");
    }
    this.dns = dns;
    if (socketFactory == null) {
        throw new IllegalArgumentException("socketFactory == null");
    }
    this.socketFactory = socketFactory;
    if (authenticator == null) {
        throw new IllegalArgumentException("authenticator == null");
    }
    this.authenticator = authenticator;
    if (protocols == null) {
        throw new IllegalArgumentException("protocols == null");
    }
    this.protocols = Util.immutableList((List) protocols);
    if (connectionSpecs == null) {
        throw new IllegalArgumentException("connectionSpecs == null");
    }
    this.connectionSpecs = Util.immutableList((List) connectionSpecs);
    if (proxySelector == null) {
        throw new IllegalArgumentException("proxySelector == null");
    }
    this.proxySelector = proxySelector;
    this.proxy = proxy;
    this.sslSocketFactory = sslSocketFactory;
    this.hostnameVerifier = hostnameVerifier;
    this.certificatePinner = certificatePinner;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:Address.java

示例5: cipherSuites

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public List<CipherSuite> cipherSuites() {
    if (this.cipherSuites == null) {
        return null;
    }
    Object[] result = new CipherSuite[this.cipherSuites.length];
    for (int i = 0; i < this.cipherSuites.length; i++) {
        result[i] = CipherSuite.forJavaName(this.cipherSuites[i]);
    }
    return Util.immutableList(result);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ConnectionSpec.java

示例6: tlsVersions

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public List<TlsVersion> tlsVersions() {
    if (this.tlsVersions == null) {
        return null;
    }
    Object[] result = new TlsVersion[this.tlsVersions.length];
    for (int i = 0; i < this.tlsVersions.length; i++) {
        result[i] = TlsVersion.forJavaName(this.tlsVersions[i]);
    }
    return Util.immutableList(result);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ConnectionSpec.java

示例7: Address

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public Address(String uriHost, int uriPort, SSLSocketFactory sslSocketFactory,
    HostnameVerifier hostnameVerifier, OkAuthenticator authenticator, Proxy proxy,
    List<String> transports) throws UnknownHostException {
  if (uriHost == null) throw new NullPointerException("uriHost == null");
  if (uriPort <= 0) throw new IllegalArgumentException("uriPort <= 0: " + uriPort);
  if (authenticator == null) throw new IllegalArgumentException("authenticator == null");
  if (transports == null) throw new IllegalArgumentException("transports == null");
  this.proxy = proxy;
  this.uriHost = uriHost;
  this.uriPort = uriPort;
  this.sslSocketFactory = sslSocketFactory;
  this.hostnameVerifier = hostnameVerifier;
  this.authenticator = authenticator;
  this.transports = Util.immutableList(transports);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:16,代码来源:Address.java

示例8: setConnectionSpecs

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
public OkHttpClient setConnectionSpecs(List<ConnectionSpec> connectionSpecs) {
    this.connectionSpecs = Util.immutableList((List) connectionSpecs);
    return this;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:OkHttpClient.java

示例9: setTransports

import com.squareup.okhttp.internal.Util; //导入方法依赖的package包/类
/**
 * Configure the transports used by this client to communicate with remote
 * servers. By default this client will prefer the most efficient transport
 * available, falling back to more ubiquitous transports. Applications should
 * only call this method to avoid specific compatibility problems, such as web
 * servers that behave incorrectly when SPDY is enabled.
 *
 * <p>The following transports are currently supported:
 * <ul>
 *   <li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">http/1.1</a>
 *   <li><a href="http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3">spdy/3</a>
 * </ul>
 *
 * <p><strong>This is an evolving set.</strong> Future releases may drop
 * support for transitional transports (like spdy/3), in favor of their
 * successors (spdy/4 or http/2.0). The http/1.1 transport will never be
 * dropped.
 *
 * <p>If multiple protocols are specified, <a
 * href="https://technotes.googlecode.com/git/nextprotoneg.html">NPN</a> will
 * be used to negotiate a transport. Future releases may use another mechanism
 * (such as <a href="http://tools.ietf.org/html/draft-friedl-tls-applayerprotoneg-02">ALPN</a>)
 * to negotiate a transport.
 *
 * @param transports the transports to use, in order of preference. The list
 *     must contain "http/1.1". It must not contain null.
 */
public OkHttpClient setTransports(List<String> transports) {
  transports = Util.immutableList(transports);
  if (!transports.contains("http/1.1")) {
    throw new IllegalArgumentException("transports doesn't contain http/1.1: " + transports);
  }
  if (transports.contains(null)) {
    throw new IllegalArgumentException("transports must not contain null");
  }
  if (transports.contains("")) {
    throw new IllegalArgumentException("transports contains an empty string");
  }
  this.transports = transports;
  return this;
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:42,代码来源:OkHttpClient.java


注:本文中的com.squareup.okhttp.internal.Util.immutableList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。