public final class NetworkManager extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.String,java.lang.Throwable> |
NETWORK_ERRORS |
private static java.util.Set<OnlineResource> |
OFFLINE_RESOURCES |
| Modifier | Constructor and Description |
|---|---|
private |
NetworkManager() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Throwable |
addNetworkError(java.lang.String url,
java.lang.Throwable t)
Adds a new network error that occur to give a hint about broken Internet connection.
|
static java.lang.Throwable |
addNetworkError(java.net.URL url,
java.lang.Throwable t)
Adds a new network error that occur to give a hint about broken Internet connection.
|
static void |
clearNetworkErrors()
Clears the network errors cache.
|
static java.util.Map<java.lang.String,java.lang.Throwable> |
getNetworkErrors()
Returns the network errors that occurred until now.
|
static java.util.Set<OnlineResource> |
getOfflineResources()
Replies the set of online resources currently offline.
|
static boolean |
isOffline(OnlineResource r)
Determines if the given online resource is currently offline.
|
static boolean |
setOffline(OnlineResource r)
Sets the given online resource to offline state.
|
static boolean |
setOnline(OnlineResource r)
Sets the given online resource to online state.
|
private static final java.util.Map<java.lang.String,java.lang.Throwable> NETWORK_ERRORS
private static final java.util.Set<OnlineResource> OFFLINE_RESOURCES
private NetworkManager()
public static java.lang.Throwable addNetworkError(java.lang.String url, java.lang.Throwable t)
url - The accessed URL that caused the errort - The network errornullpublic static java.lang.Throwable addNetworkError(java.net.URL url, java.lang.Throwable t)
url - The accessed URL that caused the errort - The network errornullpublic static java.util.Map<java.lang.String,java.lang.Throwable> getNetworkErrors()
public static void clearNetworkErrors()
public static boolean isOffline(OnlineResource r)
r - the online resourcetrue if r is offline and should not be accessedpublic static boolean setOffline(OnlineResource r)
r - the online resourcetrue if r was not already offlinepublic static boolean setOnline(OnlineResource r)
r - the online resourcetrue if r was offlinepublic static java.util.Set<OnlineResource> getOfflineResources()