Package org.openstreetmap.josm.io
Class NetworkManager
java.lang.Object
org.openstreetmap.josm.io.NetworkManager
Handles global network features (errors and online/offline resources).
- Since:
- 14121
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThrowableaddNetworkError(String url, Throwable t) Adds a new network error that occur to give a hint about broken Internet connection.static ThrowableaddNetworkError(URL url, Throwable t) Adds a new network error that occur to give a hint about broken Internet connection.static voidClears the network errors cache.Returns the network errors that occurred until now.static Set<OnlineResource>Replies the set of online resources currently offline.static booleanDetermines if the given online resource specified as URL is currently offline.static booleanDetermines if the given online resource is currently offline.static booleanSets the given online resource to offline state.static booleanSets the given online resource to online state.
-
Field Details
-
NETWORK_ERRORS
-
OFFLINE_RESOURCES
-
-
Constructor Details
-
NetworkManager
private NetworkManager()
-
-
Method Details
-
addNetworkError
Adds a new network error that occur to give a hint about broken Internet connection. Do not use this method for errors known for sure thrown because of a bad proxy configuration.- Parameters:
url- The accessed URL that caused the errort- The network error- Returns:
- The previous error associated to the given resource, if any. Can be
null
-
addNetworkError
Adds a new network error that occur to give a hint about broken Internet connection. Do not use this method for errors known for sure thrown because of a bad proxy configuration.- Parameters:
url- The accessed URL that caused the errort- The network error- Returns:
- The previous error associated to the given resource, if any. Can be
null
-
getNetworkErrors
Returns the network errors that occurred until now.- Returns:
- the network errors that occurred until now, indexed by URL
-
clearNetworkErrors
Clears the network errors cache. -
isOffline
Determines if the given online resource specified as URL is currently offline.- Parameters:
url- the online resource specified as URL- Returns:
trueifurlis offline and should not be accessed- Since:
- 16426
-
isOffline
Determines if the given online resource is currently offline.- Parameters:
r- the online resource- Returns:
trueifris offline and should not be accessed
-
setOffline
Sets the given online resource to offline state.- Parameters:
r- the online resource- Returns:
trueifrwas not already offline
-
setOnline
Sets the given online resource to online state.- Parameters:
r- the online resource- Returns:
trueifrwas offline
-
getOfflineResources
Replies the set of online resources currently offline.- Returns:
- the set of online resources currently offline
-