java.lang.Object
org.seppiko.commons.utils.http.URIUtil
URI utility
[scheme ":"] ["//" authority] "/" path ["?" query] ["#" fragment]
authority = [userinfo "@"] host [":" port]
userinfo = username [":" password]
But the URI definition requires that the scheme must be used.- Author:
- Leonard Woo
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetFileExtension(String filename) get file extensionstatic StringgetLastPathname(String uri) Get last path name (e.g.protected static URIget URI objectstatic booleanTest ip string is IPv4static booleanTest ip string is IPv6
-
Method Details
-
getUri
get URI object- Parameters:
uri- URI address (like url)- Returns:
- URI object
- Throws:
NullPointerException- If uri string is nullIllegalArgumentException- If the given string violates RFC 2396
-
isIPv4
Test ip string is IPv4- Parameters:
ip- ip string- Returns:
- true if ip is IPv4 string, false otherwise
-
isIPv6
Test ip string is IPv6- Parameters:
ip- ip string- Returns:
- true if ip is IPv6 string, false otherwise
-
getLastPathname
public static String getLastPathname(String uri) throws IllegalArgumentException, NullPointerException Get last path name (e.g. filename)- Parameters:
uri- URI- Returns:
- last path content e.g. filename
- Throws:
IllegalArgumentException- uri is not legal URINullPointerException- uri is null
-
getFileExtension
get file extension- Parameters:
filename- file name (e.g. last pathname)- Returns:
- file extension, if not found return null
- Throws:
NullPointerException- filename is null
-