diff options
author | Victor Chang <vichang@google.com> | 2021-06-24 15:02:44 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-24 15:02:44 +0000 |
commit | fb2ba4368124f84243acc225b879b82652179a87 (patch) | |
tree | 36642709f6ab6db2fd84224c7394f295899b6ecc | |
parent | f96f3d20e1321558d0cbe35dc8a9ab95d40cf20b (diff) | |
parent | 4be57c04a85daaed7e595e3b77967b32ade2c3de (diff) | |
download | okhttp-fb2ba4368124f84243acc225b879b82652179a87.tar.gz |
Document and @hide okhttp APIs am: 4be57c04a8
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/okhttp/+/15080380
Change-Id: I6c1d3385b11bf722016af6d8b2b477666e88138e
8 files changed, 104 insertions, 2 deletions
diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java b/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java index a7a5eba..bf7e9a9 100644 --- a/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java +++ b/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java @@ -44,6 +44,11 @@ public final class AndroidResponseCacheAdapter { private final CacheHolder cacheHolder; private final Cache okHttpCache; + /** + * Creates an instance from {@link CacheHolder} + * + * @hide + */ @libcore.api.CorePlatformApi public AndroidResponseCacheAdapter(CacheHolder cacheHolder) { this.cacheHolder = cacheHolder; @@ -54,6 +59,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the {@link CacheHolder} associated with this instance and can be used by OkHttp * internal code to obtain the underlying OkHttp Cache object. + * + * @hide */ @libcore.api.CorePlatformApi public CacheHolder getCacheHolder() { @@ -63,6 +70,8 @@ public final class AndroidResponseCacheAdapter { /** * Used to implement {@link java.net.ResponseCache#get(URI, String, Map)}. See that method for * details. + * + * @hide */ @libcore.api.CorePlatformApi public CacheResponse get(URI uri, String requestMethod, @@ -78,6 +87,8 @@ public final class AndroidResponseCacheAdapter { /** * Used to implement {@link java.net.ResponseCache#put(URI, URLConnection)}. See that method for * details. + * + * @hide */ @libcore.api.CorePlatformApi public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException { @@ -98,6 +109,8 @@ public final class AndroidResponseCacheAdapter { * Returns the number of bytes currently being used to store the values in * this cache. This may be greater than the {@link #getMaxSize()} if a background * deletion is pending. IOException is thrown if the size cannot be determined. + * + * @hide */ @libcore.api.CorePlatformApi public long getSize() throws IOException { @@ -107,6 +120,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the maximum number of bytes that this cache should use to store * its data. + * + * @hide */ @libcore.api.CorePlatformApi public long getMaxSize() { @@ -117,6 +132,8 @@ public final class AndroidResponseCacheAdapter { * Force buffered operations to the filesystem. This ensures that responses * written to the cache will be available the next time the cache is opened, * even if this process is killed. IOException is thrown if the flush fails. + * + * @hide */ @libcore.api.CorePlatformApi public void flush() throws IOException { @@ -126,6 +143,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the number of HTTP requests that required the network to either * supply a response or validate a locally cached response. + * + * @hide */ @libcore.api.CorePlatformApi public int getNetworkCount() { @@ -136,6 +155,8 @@ public final class AndroidResponseCacheAdapter { * Returns the number of HTTP requests whose response was provided by the * cache. This may include conditional {@code GET} requests that were * validated over the network. + * + * @hide */ @libcore.api.CorePlatformApi public int getHitCount() { @@ -146,13 +167,19 @@ public final class AndroidResponseCacheAdapter { * Returns the total number of HTTP requests that were made. This includes * both client requests and requests that were made on the client's behalf * to handle a redirects and retries. + * + * @hide */ @libcore.api.CorePlatformApi public int getRequestCount() { return okHttpCache.getRequestCount(); } - /** Closes this cache. Stored values will remain on the filesystem. */ + /** + * Closes this cache. Stored values will remain on the filesystem. + * + * @hide + */ @libcore.api.CorePlatformApi public void close() throws IOException { okHttpCache.close(); @@ -162,6 +189,8 @@ public final class AndroidResponseCacheAdapter { * Closes the cache and deletes all of its stored values. This will delete * all files in the cache directory including files that weren't created by * the cache. + * + * @hide */ @libcore.api.CorePlatformApi public void delete() throws IOException { diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java b/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java index 6558dfe..20f84da 100644 --- a/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java +++ b/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java @@ -29,6 +29,8 @@ public interface Dns { /** * Returns the IP addresses of {@code hostname}, in the order they should * be attempted. + * + * @hide */ @libcore.api.CorePlatformApi List<InetAddress> lookup(String hostname) throws UnknownHostException; diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java b/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java index e990af4..895b576 100644 --- a/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java +++ b/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java @@ -29,6 +29,8 @@ public interface HasCacheHolder { /** * Returns the {@link CacheHolder} object. + * + * @hide */ @libcore.api.CorePlatformApi CacheHolder getCacheHolder(); @@ -68,6 +70,8 @@ public interface HasCacheHolder { * * @param directory a writable directory * @param maxSizeBytes the maximum number of bytes this cache should use to store + * + * @hide */ @libcore.api.CorePlatformApi public static CacheHolder create(File directory, long maxSizeBytes) { @@ -78,6 +82,8 @@ public interface HasCacheHolder { /** * Returns true if the arguments supplied would result in an equivalent cache to this one * being created if they were passed to {@link #create(File, long)}. + * + * @hide */ @libcore.api.CorePlatformApi public boolean isEquivalent(File directory, long maxSizeBytes) { diff --git a/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java b/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java index a7d0bbf..d6a7402 100644 --- a/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java +++ b/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java @@ -57,6 +57,7 @@ public final class HttpURLConnectionFactory { private ConnectionPool connectionPool; private com.squareup.okhttp.Dns dns; + /** @hide */ @libcore.api.CorePlatformApi public HttpURLConnectionFactory() { } @@ -64,6 +65,8 @@ public final class HttpURLConnectionFactory { /** * Sets a new ConnectionPool, specific to this URLFactory and not shared with * any other connections, with the given configuration. + * + * @hide */ @libcore.api.CorePlatformApi public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration, @@ -71,6 +74,7 @@ public final class HttpURLConnectionFactory { this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit); } + /** @hide */ @libcore.api.CorePlatformApi public void setDns(Dns dns) { Objects.requireNonNull(dns); @@ -79,6 +83,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the system default proxy settings and SocketFactory. + * + * @hide */ public URLConnection openConnection(URL url) throws IOException { return internalOpenConnection(url, null /* socketFactory */, null /* proxy */); @@ -87,6 +93,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the system default SocketFactory and the specified * proxy settings. + * + * @hide */ public URLConnection openConnection(URL url, Proxy proxy) throws IOException { Objects.requireNonNull(proxy); @@ -96,6 +104,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the specified SocketFactory and the system default * proxy settings. + * + * @hide */ public URLConnection openConnection(URL url, SocketFactory socketFactory) throws IOException { Objects.requireNonNull(socketFactory); @@ -105,6 +115,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection using the specified SocketFactory and the specified proxy * settings, overriding any system wide configuration. + * + * @hide */ @libcore.api.CorePlatformApi public URLConnection openConnection(URL url, SocketFactory socketFactory, Proxy proxy) @@ -148,6 +160,8 @@ public final class HttpURLConnectionFactory { /** * Adapts a {@link Dns} as a {@link com.squareup.okhttp.Dns}. + * + * @hide */ static final class DnsAdapter implements com.squareup.okhttp.Dns { private final Dns adaptee; diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java index b7f5002..20f8359 100644 --- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java +++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/AndroidResponseCacheAdapter.java @@ -46,6 +46,11 @@ public final class AndroidResponseCacheAdapter { private final CacheHolder cacheHolder; private final Cache okHttpCache; + /** + * Creates an instance from {@link CacheHolder} + * + * @hide + */ @libcore.api.CorePlatformApi public AndroidResponseCacheAdapter(CacheHolder cacheHolder) { this.cacheHolder = cacheHolder; @@ -56,6 +61,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the {@link CacheHolder} associated with this instance and can be used by OkHttp * internal code to obtain the underlying OkHttp Cache object. + * + * @hide */ @libcore.api.CorePlatformApi public CacheHolder getCacheHolder() { @@ -65,6 +72,8 @@ public final class AndroidResponseCacheAdapter { /** * Used to implement {@link java.net.ResponseCache#get(URI, String, Map)}. See that method for * details. + * + * @hide */ @libcore.api.CorePlatformApi public CacheResponse get(URI uri, String requestMethod, @@ -80,6 +89,8 @@ public final class AndroidResponseCacheAdapter { /** * Used to implement {@link java.net.ResponseCache#put(URI, URLConnection)}. See that method for * details. + * + * @hide */ @libcore.api.CorePlatformApi public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException { @@ -100,6 +111,8 @@ public final class AndroidResponseCacheAdapter { * Returns the number of bytes currently being used to store the values in * this cache. This may be greater than the {@link #getMaxSize()} if a background * deletion is pending. IOException is thrown if the size cannot be determined. + * + * @hide */ @libcore.api.CorePlatformApi public long getSize() throws IOException { @@ -109,6 +122,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the maximum number of bytes that this cache should use to store * its data. + * + * @hide */ @libcore.api.CorePlatformApi public long getMaxSize() { @@ -119,6 +134,8 @@ public final class AndroidResponseCacheAdapter { * Force buffered operations to the filesystem. This ensures that responses * written to the cache will be available the next time the cache is opened, * even if this process is killed. IOException is thrown if the flush fails. + * + * @hide */ @libcore.api.CorePlatformApi public void flush() throws IOException { @@ -128,6 +145,8 @@ public final class AndroidResponseCacheAdapter { /** * Returns the number of HTTP requests that required the network to either * supply a response or validate a locally cached response. + * + * @hide */ @libcore.api.CorePlatformApi public int getNetworkCount() { @@ -138,6 +157,8 @@ public final class AndroidResponseCacheAdapter { * Returns the number of HTTP requests whose response was provided by the * cache. This may include conditional {@code GET} requests that were * validated over the network. + * + * @hide */ @libcore.api.CorePlatformApi public int getHitCount() { @@ -148,13 +169,19 @@ public final class AndroidResponseCacheAdapter { * Returns the total number of HTTP requests that were made. This includes * both client requests and requests that were made on the client's behalf * to handle a redirects and retries. + * + * @hide */ @libcore.api.CorePlatformApi public int getRequestCount() { return okHttpCache.getRequestCount(); } - /** Closes this cache. Stored values will remain on the filesystem. */ + /** + * Closes this cache. Stored values will remain on the filesystem. + * + * @hide + */ @libcore.api.CorePlatformApi public void close() throws IOException { okHttpCache.close(); @@ -164,6 +191,8 @@ public final class AndroidResponseCacheAdapter { * Closes the cache and deletes all of its stored values. This will delete * all files in the cache directory including files that weren't created by * the cache. + * + * @hide */ @libcore.api.CorePlatformApi public void delete() throws IOException { diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java index 859ea80..104f23f 100644 --- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java +++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/Dns.java @@ -31,6 +31,8 @@ public interface Dns { /** * Returns the IP addresses of {@code hostname}, in the order they should * be attempted. + * + * @hide */ @libcore.api.CorePlatformApi List<InetAddress> lookup(String hostname) throws UnknownHostException; diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java index aa90bf3..757c006 100644 --- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java +++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HasCacheHolder.java @@ -31,6 +31,8 @@ public interface HasCacheHolder { /** * Returns the {@link CacheHolder} object. + * + * @hide */ @libcore.api.CorePlatformApi CacheHolder getCacheHolder(); @@ -70,6 +72,8 @@ public interface HasCacheHolder { * * @param directory a writable directory * @param maxSizeBytes the maximum number of bytes this cache should use to store + * + * @hide */ @libcore.api.CorePlatformApi public static CacheHolder create(File directory, long maxSizeBytes) { @@ -80,6 +84,8 @@ public interface HasCacheHolder { /** * Returns true if the arguments supplied would result in an equivalent cache to this one * being created if they were passed to {@link #create(File, long)}. + * + * @hide */ @libcore.api.CorePlatformApi public boolean isEquivalent(File directory, long maxSizeBytes) { diff --git a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java index 7f83ee5..91266ab 100644 --- a/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java +++ b/repackaged/android/src/main/java/com/android/okhttp/internalandroidapi/HttpURLConnectionFactory.java @@ -59,6 +59,7 @@ public final class HttpURLConnectionFactory { private ConnectionPool connectionPool; private com.android.okhttp.Dns dns; + /** @hide */ @libcore.api.CorePlatformApi public HttpURLConnectionFactory() { } @@ -66,6 +67,8 @@ public final class HttpURLConnectionFactory { /** * Sets a new ConnectionPool, specific to this URLFactory and not shared with * any other connections, with the given configuration. + * + * @hide */ @libcore.api.CorePlatformApi public void setNewConnectionPool(int maxIdleConnections, long keepAliveDuration, @@ -73,6 +76,7 @@ public final class HttpURLConnectionFactory { this.connectionPool = new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit); } + /** @hide */ @libcore.api.CorePlatformApi public void setDns(Dns dns) { Objects.requireNonNull(dns); @@ -81,6 +85,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the system default proxy settings and SocketFactory. + * + * @hide */ public URLConnection openConnection(URL url) throws IOException { return internalOpenConnection(url, null /* socketFactory */, null /* proxy */); @@ -89,6 +95,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the system default SocketFactory and the specified * proxy settings. + * + * @hide */ public URLConnection openConnection(URL url, Proxy proxy) throws IOException { Objects.requireNonNull(proxy); @@ -98,6 +106,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection that uses the specified SocketFactory and the system default * proxy settings. + * + * @hide */ public URLConnection openConnection(URL url, SocketFactory socketFactory) throws IOException { Objects.requireNonNull(socketFactory); @@ -107,6 +117,8 @@ public final class HttpURLConnectionFactory { /** * Opens a connection using the specified SocketFactory and the specified proxy * settings, overriding any system wide configuration. + * + * @hide */ @libcore.api.CorePlatformApi public URLConnection openConnection(URL url, SocketFactory socketFactory, Proxy proxy) @@ -150,6 +162,8 @@ public final class HttpURLConnectionFactory { /** * Adapts a {@link Dns} as a {@link com.android.okhttp.Dns}. + * + * @hide */ static final class DnsAdapter implements com.android.okhttp.Dns { private final Dns adaptee; |