Package org.openjump.util
Class UriUtil
- java.lang.Object
-
- org.openjump.util.UriUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URIcreateFileUri(String file)static URIcreateZipUri(File file, String entry)Create a URI to the entry within a ZIP file.static URIcreateZipUri(String file, String entry)static StringgetFileExtension(URI uri)Get the file extension from the URI path.static StringgetFileName(String path)static StringgetFileName(URI uri)Get the file name from the URI path.static StringgetFileNameWithoutExtension(URI uri)Get the file name without the extension from the URI path.static StringgetFilePath(URI uri)static Map<String,String>getParameters(URI uri)static StringgetPath(String path)static StringgetZipEntryFilePath(URI uri)Get the path to an entry in a ZIP URI.static StringgetZipEntryName(URI uri)Get the name of a ZIP file entry from a ZIP URI.static FilegetZipFile(URI uri)Get the ZIP file from a ZIP URI.static StringgetZipFileName(URI uri)static StringgetZipFilePath(URI uri)static booleanisURL(String in)static StringremoveExtension(String path)static StringurlAddCredentials(String url, String user, String pass)static StringurlAddUserInfo(String url, String userinfo)userinfo is the prepared urlencoded string before the @ eg.static StringurlDecode(String in)static StringurlEncode(String in)static StringurlGetHost(String url)static StringurlGetPassword(String url)static StringurlGetPath(String url)static StringurlGetPort(String url)static StringurlGetUser(String url)static StringurlGetUserInfo(String url)userinfo is the prepared urlencoded string before the @ eg.static StringurlMakeAppendSafe(String url)Make sure the url string ends with '?' or '&' to safely append url parametersstatic StringurlStripAuth(String url)static StringurlStripPassword(String url)
-
-
-
Method Detail
-
createZipUri
public static URI createZipUri(File file, String entry)
Create a URI to the entry within a ZIP file.- Parameters:
file- The ZIP file.entry- The ZIP entry.- Returns:
- The URI.
-
getZipFile
public static File getZipFile(URI uri)
Get the ZIP file from a ZIP URI.- Parameters:
uri- The URI.- Returns:
- The ZIP file.
-
getZipEntryName
public static String getZipEntryName(URI uri)
Get the name of a ZIP file entry from a ZIP URI.- Parameters:
uri- The URI.- Returns:
- The ZIP entry name.
-
getFileExtension
public static String getFileExtension(URI uri)
Get the file extension from the URI path.- Parameters:
uri- The URI.- Returns:
- The file extension.
-
getFileName
public static String getFileName(URI uri)
Get the file name from the URI path.- Parameters:
uri- The URI.- Returns:
- The file name.
-
getFileNameWithoutExtension
public static String getFileNameWithoutExtension(URI uri)
Get the file name without the extension from the URI path.- Parameters:
uri- The URI.- Returns:
- The file name.
-
getZipEntryFilePath
public static String getZipEntryFilePath(URI uri)
Get the path to an entry in a ZIP URI.- Parameters:
uri- The zip URI- Returns:
- The entry's path.
-
isURL
public static boolean isURL(String in)
-
urlGetUserInfo
public static String urlGetUserInfo(String url)
userinfo is the prepared urlencoded string before the @ eg. user:pass- Parameters:
url- URL string to get the user info from- Returns:
- a String representing user info of the URL
-
urlMakeAppendSafe
public static String urlMakeAppendSafe(String url)
Make sure the url string ends with '?' or '&' to safely append url parameters- Parameters:
url- string- Returns:
- url string safe to append parameters
-
urlAddUserInfo
public static String urlAddUserInfo(String url, String userinfo)
userinfo is the prepared urlencoded string before the @ eg. user:pass- Parameters:
url- url String to add user info touserinfo- user info to add- Returns:
- url with added user info
-
-