Package ml.karmaconfigs.api.common.utils
Class URLUtils
java.lang.Object
ml.karmaconfigs.api.common.utils.URLUtils
Karma URL utilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanGet if the URL existsstatic voidfastConnect(URL url)Connect and instantly disconnect from a URL.static @Nullable URLgetOrBackup(String def, String... backup)Get the url or defaultstatic @Nullable URLGet the URL or null if couldn't retrieve specified URLstatic StringgetResponse(URL url)Get the web responsestatic intgetResponseCode(String url)Get the URL response code
-
Constructor Details
-
URLUtils
public URLUtils()
-
-
Method Details
-
fastConnect
Connect and instantly disconnect from a URL. This method may be called only when actually needed- Parameters:
url- the url to connect
-
exists
Get if the URL exists- Parameters:
url- the url- Returns:
- if the url exists
-
getResponseCode
Get the URL response code- Parameters:
url- the url- Returns:
- the URL response code
-
getOrNull
Get the URL or null if couldn't retrieve specified URL- Parameters:
url- the url- Returns:
- the url or null
-
getOrBackup
Get the url or default- Parameters:
def- the default urlbackup- the backup urls- Returns:
- the url or defaults
-
getResponse
Get the web response- Parameters:
url- the url to fetch response from- Returns:
- the web response or empty
-