Package skyview.survey
Class Util
- java.lang.Object
-
- skyview.survey.Util
-
public class Util extends Object
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStream
getResourceOrFile(String name)
Open a stream from a resource or a file.static void
getURL(String url, String file)
Copy a URL to a local filestatic String
replace(String original, String match, String replace, boolean all)
static String
replacePrefix(String value, String[] prefixes)
Replace one prefix string with another.
-
-
-
Method Detail
-
getURL
public static void getURL(String url, String file) throws Exception
Copy a URL to a local file- Throws:
Exception
-
getResourceOrFile
public static InputStream getResourceOrFile(String name) throws IOException
Open a stream from a resource or a file. If a file with the given name exists then return a stream from that file, otherwise try to open it as a system resource.- Parameters:
name
- The name of the resource or file.- Throws:
IOException
-
replacePrefix
public static String replacePrefix(String value, String[] prefixes)
Replace one prefix string with another. This is used, e.g., to replace URLs with local file access.- Parameters:
value
- The string to be modifed.prefixes
- A 2 element array where we will look for the first prefix at the beginning of value and if found replace it with the second prefix.- Returns:
- The string with the prefix replaced if found.
-
-