![]() | [using it] | Interface Manipulation Package v4.0 (2008-06-25) | ![]() | ©copyright | ![]() |
java.lang.Objectimp.util.URLs
public class URLs
This factory contains methods to load/save URL's contents.
Method Summary | |
---|---|
static BufferedImage |
loadImage(String location)
Loads an image from the given location. |
static String |
loadString(String location,
Value query)
Loads an URL textual contents and returns it as a string. |
static void |
play(String location)
Plays an audio clip (stop playing previous clip if the location is null). |
static void |
saveImage(String location,
BufferedImage image)
Saves an image at the given location in png format. |
static void |
saveString(String location,
String string)
Saves a char-sequence in an URL textual contents. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static BufferedImage loadImage(String location) throws IOException
location
- A Universal Resource Location of the form: http:/path-name | to load from a HTTP location |
ftp:/path-name | to load from a FTP site |
file:/path-name | to load from a file |
jar:/jar-path-name!/jar-entry | to load from a JAR archive |
IOException
- if an I/O exception has occurred.public static String loadString(String location, Value query) throws IOException
location
- A Universal Resource Location of the form: http:/path-name | to load from a HTTP location |
http:/path-name?param_i=value_i&.. | to get a form answer |
servlet:host-name:port?param_i=value_i&.. | to get a query from a servlet |
ftp:/path-name | to load from a FTP site |
file:/path-name | to load from a file |
jar:/jar-path-name!/jar-entry | to load from a JAR archive
(e.g.:jar:http:/www-sop.inria.fr/odyssee/imp/imp.jar!/META-INF/MANIFEST.MF) |
stdin: | to load the whole stdin contents. |
query
- [optional, default is added to the host-name or null] The query fields (i.e. parameters of the form name=value). It can also be specified
with the location using the <location>?<name>=<value&.. URL encoded construct or omitted.
IOException
- if an I/O exception has occurred.public static void play(String location) throws IOException
location
- A Universal Resource Location of the form: http:/path-name | to load from a HTTP location |
ftp:/path-name | to load from a FTP site |
file:/path-name | to load from a file |
jar:/jar-path-name!/jar-entry | to load from a JAR archive |
IOException
- if an I/O exception has occurred.public static void saveImage(String location, BufferedImage image) throws IOException
location
- A Universal Resource Location of the form: ftp:/path-name | to save onto a FTP site. |
file:/path-name | to save into a file. |
image
- The image to save.
IOException
- if an I/O exception has occurred.public static void saveString(String location, String string) throws IOException
location
- [optional, default is "stdout:"] A Universal Resource Location of the form: ftp:/path-name | to save onto a FTP site. |
file:/path-name | to save into a file. |
mailto:address?subject=subject | to send as an email in a readable form. |
stdout:/ | to print to the terminal standard output. |
string
- The string to save.
IOException
- if an I/O exception has occurred.