Package gov.nasa.arc.pds.tools.util
Class URLUtils
java.lang.Object
gov.nasa.arc.pds.tools.util.URLUtils
This class provides utilities for URL manipulation.
- Author:
- jagander
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanstatic URLgetAlternateCaseURL(URL url) static URLgetCaseUnknownURL(URI root, String path) static URLgetCaseUnknownURL(URL url) static URLgetCaseUnknownURL(URL root, String path) static StringgetCharset(String contentType, String defaultCharset) static StringgetCharset(URLConnection connection, String defaultCharset) static URLContentsContainergetContent(URL url) static URLContentsContainergetContent(URL url, long maxLength) static intgetContentLength(URL url) static StringgetContentType(URL url) static StringgetContentType(URLConnection connection, URL url, InputStream is) static StringgetFileName(String url) static StringgetFileName(URI uri) static StringgetFileName(URL url) static URLgetParentURL(URI uri) static URLgetParentURL(URL url) static StringgetParentURLString(URL url) static URLstatic URLtoSecureUrl(URL url) Converts an HTTP URL to HTTPS to ensure a secure connection.
-
Field Details
-
TEXT_CONTENT_TYPES
-
-
Constructor Details
-
URLUtils
public URLUtils()
-
-
Method Details
-
exists
-
toSecureUrl
Converts an HTTP URL to HTTPS to ensure a secure connection. Non-HTTP URLs (e.g. file://, https://) are returned unchanged.- Parameters:
url- the URL to convert- Returns:
- an HTTPS URL if the input uses HTTP, otherwise the original URL
-
exists
-
getAlternateCaseURL
-
getCaseUnknownURL
-
getCaseUnknownURL
-
getCaseUnknownURL
-
getFileName
-
getFileName
-
getFileName
-
getParentURLString
-
getParentURL
-
getParentURL
-
getContent
- Throws:
IOException
-
getContent
- Throws:
IOException
-
getContentType
- Throws:
IOException
-
getContentType
-
getCharset
-
getCharset
-
getContentLength
-
newURL
- Throws:
MalformedURLException
-