Package gov.nasa.arc.pds.tools.util
Class URLUtils
- java.lang.Object
-
- gov.nasa.arc.pds.tools.util.URLUtils
-
public class URLUtils extends java.lang.Object
This class provides utilities for URL manipulation.- Author:
- jagander
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.String>
TEXT_CONTENT_TYPES
-
Constructor Summary
Constructors Constructor Description URLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
exists(java.net.URI uri)
static boolean
exists(java.net.URL url)
static java.net.URL
getAlternateCaseURL(java.net.URL url)
static java.net.URL
getCaseUnknownURL(java.net.URI root, java.lang.String path)
static java.net.URL
getCaseUnknownURL(java.net.URL url)
static java.net.URL
getCaseUnknownURL(java.net.URL root, java.lang.String path)
static java.lang.String
getCharset(java.lang.String contentType, java.lang.String defaultCharset)
static java.lang.String
getCharset(java.net.URLConnection connection, java.lang.String defaultCharset)
static URLContentsContainer
getContent(java.net.URL url)
static URLContentsContainer
getContent(java.net.URL url, long maxLength)
static int
getContentLength(java.net.URL url)
static java.lang.String
getContentType(java.net.URL url)
static java.lang.String
getContentType(java.net.URLConnection connection, java.net.URL url, java.io.InputStream is)
static java.lang.String
getFileName(java.lang.String url)
static java.lang.String
getFileName(java.net.URI uri)
static java.lang.String
getFileName(java.net.URL url)
static java.net.URL
getParentURL(java.net.URI uri)
static java.net.URL
getParentURL(java.net.URL url)
static java.lang.String
getParentURLString(java.net.URL url)
static java.net.URL
newURL(java.net.URL base, java.lang.String filename)
-
-
-
Method Detail
-
exists
public static boolean exists(java.net.URI uri)
-
exists
public static boolean exists(java.net.URL url)
-
getAlternateCaseURL
public static java.net.URL getAlternateCaseURL(java.net.URL url)
-
getCaseUnknownURL
public static java.net.URL getCaseUnknownURL(java.net.URL url)
-
getCaseUnknownURL
public static java.net.URL getCaseUnknownURL(java.net.URI root, java.lang.String path)
-
getCaseUnknownURL
public static java.net.URL getCaseUnknownURL(java.net.URL root, java.lang.String path)
-
getFileName
public static java.lang.String getFileName(java.lang.String url)
-
getFileName
public static java.lang.String getFileName(java.net.URI uri)
-
getFileName
public static java.lang.String getFileName(java.net.URL url)
-
getParentURLString
public static java.lang.String getParentURLString(java.net.URL url)
-
getParentURL
public static java.net.URL getParentURL(java.net.URL url)
-
getParentURL
public static java.net.URL getParentURL(java.net.URI uri)
-
getContent
public static URLContentsContainer getContent(java.net.URL url, long maxLength) throws java.io.IOException
- Throws:
java.io.IOException
-
getContent
public static URLContentsContainer getContent(java.net.URL url) throws java.io.IOException
- Throws:
java.io.IOException
-
getContentType
public static java.lang.String getContentType(java.net.URL url) throws java.io.IOException
- Throws:
java.io.IOException
-
getContentType
public static java.lang.String getContentType(java.net.URLConnection connection, java.net.URL url, java.io.InputStream is)
-
getCharset
public static java.lang.String getCharset(java.net.URLConnection connection, java.lang.String defaultCharset)
-
getCharset
public static java.lang.String getCharset(java.lang.String contentType, java.lang.String defaultCharset)
-
getContentLength
public static int getContentLength(java.net.URL url)
-
newURL
public static java.net.URL newURL(java.net.URL base, java.lang.String filename) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
-