Class UriUtil

java.lang.Object
org.openjump.util.UriUtil

public final class UriUtil extends Object
Utility class for handline URI.
Author:
Paul Austin
  • Method Details

    • 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.
    • createZipUri

      public static URI createZipUri(String file, String entry)
    • createFileUri

      public static URI createFileUri(String file)
    • getZipFile

      public static File getZipFile(URI uri)
      Get the ZIP file from a ZIP URI.
      Parameters:
      uri - The URI.
      Returns:
      The ZIP file.
    • getZipFilePath

      public static String getZipFilePath(URI uri)
    • getZipFileName

      public static String getZipFileName(URI uri)
    • 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.
    • getFilePath

      public static String getFilePath(URI uri)
    • getFileName

      public static String getFileName(String path)
    • getPath

      public static String getPath(String path)
    • removeExtension

      public static String removeExtension(String path)
    • urlEncode

      public static String urlEncode(String in)
    • urlDecode

      public static String urlDecode(String in)
    • isURL

      public static boolean isURL(String in)
    • urlStripAuth

      public static String urlStripAuth(String url)
    • urlGetUser

      public static String urlGetUser(String url)
    • urlGetPassword

      public static String urlGetPassword(String url)
    • 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
    • urlGetHost

      public static String urlGetHost(String url)
    • urlGetPort

      public static String urlGetPort(String url)
    • urlGetPath

      public static String urlGetPath(String url)
    • urlStripPassword

      public static String urlStripPassword(String url)
    • urlAddCredentials

      public static String urlAddCredentials(String url, String user, String pass)
    • urlMakeAppendSafe

      public static String urlMakeAppendSafe(String url)
      Make sure the url string ends with '?' or 'invalid input: '&'' 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 to
      userinfo - user info to add
      Returns:
      url with added user info
    • getParameters

      public static Map<String,String> getParameters(URI uri)