public final class URLConnectionOptions extends Object
URLConnection
.Modifier and Type | Field and Description |
---|---|
static URLConnectionOptions |
DEFAULT
Default options.
|
Constructor and Description |
---|
URLConnectionOptions()
Constructs a new default instance.
|
URLConnectionOptions(URLConnectionOptions urlConnectionOptions)
Constructs an instance with values from the given URLConnectionOptions.
|
Modifier and Type | Method and Description |
---|---|
URLConnection |
apply(URLConnection urlConnection)
Applies the options to the given connection.
|
boolean |
equals(Object obj) |
boolean |
getAllowUserInteraction()
Gets whether to allow user interaction.
|
int |
getConnectTimeoutMillis()
Gets the connect timeout.
|
int |
getReadTimeoutMillis()
Gets the read timeout.
|
boolean |
getUseCaches()
Whether to cache.
|
int |
hashCode() |
URLConnection |
openConnection(URL url)
Opens a connection for the given URL with our options.
|
URLConnectionOptions |
setAllowUserInteraction(boolean allowUserInteraction) |
URLConnectionOptions |
setConnectTimeoutMillis(int connectTimeoutMillis) |
URLConnectionOptions |
setReadTimeoutMillis(int readTimeoutMillis) |
URLConnectionOptions |
setUseCaches(boolean useCaches) |
String |
toString() |
public static final URLConnectionOptions DEFAULT
public URLConnectionOptions()
public URLConnectionOptions(URLConnectionOptions urlConnectionOptions)
urlConnectionOptions
- the sourcepublic URLConnection apply(URLConnection urlConnection)
urlConnection
- the target connection.public boolean getAllowUserInteraction()
public int getConnectTimeoutMillis()
public int getReadTimeoutMillis()
public boolean getUseCaches()
public URLConnection openConnection(URL url) throws IOException
url
- the URL to openIOException
- if an I/O exception occurs.public URLConnectionOptions setAllowUserInteraction(boolean allowUserInteraction)
public URLConnectionOptions setConnectTimeoutMillis(int connectTimeoutMillis)
public URLConnectionOptions setReadTimeoutMillis(int readTimeoutMillis)
public URLConnectionOptions setUseCaches(boolean useCaches)
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.