|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlapisx.net.URLUtil
Constructor Summary | |
URLUtil()
|
Method Summary | |
static URL |
FileToURL(File file)
Convert a local filename to a URL. |
static String |
getBasename(URL url)
Get the basename part of a URL, which is the filename without extension: e.g., "index". |
static URL |
getDirectoryURL(URL url)
Get the URL of a page's directory. |
static String |
getExtension(URL url)
Get the extension part of a URL, e.g. ".html". |
static String |
getFilename(URL url)
Get the filename part of a URL, like "index.html". |
static URL |
getPageURL(URL url)
Get the URL of a page, omitting any anchor reference (like #ref). |
static URL |
getParentURL(URL url)
Get the URL of a page's parent directory. |
static String |
getQuery(URL url)
Get the query part of the link, like "? |
static URL |
getServiceURL(URL url)
Get the URL of a Web service, omitting any query or anchor reference. |
static File |
HrefToFile(String href)
Convert a string (representing either a filename or a local file: URL) to a File. |
static File |
HrefToFile(String href,
File curdir)
|
static URL |
HrefToURL(String href)
Convert a string (representing either a filename or a URL) to a URL. |
static URL |
HrefToURL(String href,
File curdir)
Convert a string (representing either a filename or a local URL) to a URL. |
static Reader |
open(String href)
Open a file or URL. |
static Reader |
open(URL url)
Open a URL. |
static String |
relativeTo(String here,
String there)
Compute relative HREF for filename |
static String |
relativeTo(URL here,
String there)
Compute relative HREF for URL there when the current location is URL here. |
static String |
relativeTo(URL here,
URL there)
Computes relative HREF for URL there when the current location is URL here. |
static File |
URLToFile(URL url)
Convert a file: URL to a filename appropriate to the current system platform. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public URLUtil()
Method Detail |
public static URL FileToURL(File file)
file
- File to convert
public static File URLToFile(URL url) throws MalformedURLException
url
- URL to convert
MalformedURLException
- if url is not a
file: URL.public static File HrefToFile(String href) throws MalformedURLException
Examples:
href
- String to convert
MalformedURLException
- if href uses a network protocol, like http: or ftp:.public static File HrefToFile(String href, File curdir) throws MalformedURLException
MalformedURLException
public static URL HrefToURL(String href)
Examples:
href
- String to convert
public static URL HrefToURL(String href, File curdir)
Examples:
href
- String to convertcurdir
- Current directory, in case href is a relative filename
public static URL getPageURL(URL url)
url
- URL to parse
public static URL getServiceURL(URL url)
public static URL getDirectoryURL(URL url)
url
- URL to parse
public static URL getParentURL(URL url)
url
- URL to parse
public static String getFilename(URL url)
url
- URL to parse
public static String getQuery(URL url)
url
- URL to parse
public static String getBasename(URL url)
url
- URL to parse
public static String getExtension(URL url)
url
- URL to parse
public static String relativeTo(URL here, URL there)
public static String relativeTo(URL here, String there)
public static String relativeTo(String here, String there)
public static Reader open(String href) throws IOException
href
- filename or URL to open
IOException
public static Reader open(URL url) throws IOException
url
- URL to open
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |