Package gov.nasa.pds.tools.util
Class Utility
java.lang.Object
gov.nasa.pds.tools.util.Utility
Utility class.
- Author:
- mcayanan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanstatic StringfixSlashes(String sysid) Replace backslashes with forward slashes.static InputSourcegetInputSourceByURL(URL url) static URLstatic TargetTypegetTargetType(URL url) static TargetTypegetTargetType(URL source, URL label) static booleanstatic booleanstatic StringmakeAbsolute(String base, String sysid) Construct an absolute URI from a relative one, using the current base URI.static InputStreamopenConnection(URLConnection conn) Method that opens a connection.static StringremoveLastSlash(String url) static booleanConvenience method for disabling xinclude support throughout the core library.static URL
-
Constructor Details
-
Utility
public Utility()
-
-
Method Details
-
openConnection
Method that opens a connection. Supports redirects.- Parameters:
conn- URL Connection- Returns:
- input stream.
- Throws:
IOException- If an error occurred while opening the stream.
-
getInputSourceByURL
- Throws:
IOException
-
toURL
- Throws:
MalformedURLException
-
toURL
- Throws:
MalformedURLException
-
isDir
-
isDir
-
getParent
-
canRead
-
canRead
-
removeLastSlash
-
supportXincludes
public static boolean supportXincludes()Convenience method for disabling xinclude support throughout the core library.- Returns:
-
fixSlashes
Replace backslashes with forward slashes. (URLs always use forward slashes.)- Parameters:
sysid- The input system identifier.- Returns:
- The same system identifier with backslashes turned into forward slashes.
-
makeAbsolute
Construct an absolute URI from a relative one, using the current base URI.- Parameters:
sysid- The (possibly relative) system identifier- Returns:
- The system identifier made absolute with respect to the current
#base. - Throws:
MalformedURLException
-
getTargetType
-
getTargetType
-