public class Resource
extends java.lang.Object
| Modifier | Constructor | Description |
|---|---|---|
|
Resource(java.io.File file) |
Constructs a resource from a file.
|
|
Resource(java.net.URL url) |
Constructs a resource from a url.
|
protected |
Resource(java.net.URL zipURL,
java.lang.String content) |
Constructs a resource from a ZIP url with content.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
getAbsolutePath() |
Gets the absolute path.
|
java.applet.AudioClip |
getAudioClip() |
Gets an AudioClip.
|
java.awt.image.BufferedImage |
getBufferedImage() |
Gets a buffered image.
|
java.awt.image.BufferedImage |
getBufferedImage(int bufferedImageType) |
Gets a buffered image.
|
static java.nio.charset.Charset |
getCharset() |
Gets the character set used for reading input streams.
|
java.io.File |
getFile() |
Gets the file associated with this resource.
|
javax.swing.Icon |
getIcon() |
Gets an Icon.
|
java.awt.Image |
getImage() |
Gets an Image.
|
java.lang.Object |
getObject(java.lang.Class<?> type) |
Gets an object of the specified type.
|
java.lang.String |
getString() |
Gets a String.
|
java.lang.String |
getString(java.lang.String encoding) |
Gets a String encoded with a specified encoding.
|
java.net.URL |
getURL() |
Gets the url associated with this resource.
|
java.io.InputStream |
openInputStream() |
Opens an InputStream.
|
java.io.BufferedReader |
openReader() |
Opens a BufferedReader for the default character set (UTF-8).
|
java.io.BufferedReader |
openReader(java.nio.charset.Charset charset) |
Opens a BufferedReader for a specified character set.
|
public Resource(java.net.URL url)
url - the URLpublic Resource(java.io.File file)
file - the fileprotected Resource(java.net.URL zipURL,
java.lang.String content)
zipURL - the URLcontent - the path of the contents relative to the ZIP filepublic static java.nio.charset.Charset getCharset()
public java.lang.String getAbsolutePath()
public java.net.URL getURL()
public java.io.File getFile()
public java.lang.Object getObject(java.lang.Class<?> type)
type - the desired class typepublic java.io.InputStream openInputStream()
public java.io.BufferedReader openReader()
public java.io.BufferedReader openReader(java.nio.charset.Charset charset)
charset - the character setpublic javax.swing.Icon getIcon()
public java.awt.Image getImage()
public java.awt.image.BufferedImage getBufferedImage()
public java.awt.image.BufferedImage getBufferedImage(int bufferedImageType)
bufferedImageType - one of the types defined by the BufferedImage classpublic java.lang.String getString()
public java.lang.String getString(java.lang.String encoding)
encoding - the encoding (eg "ISO-8859-1" for properties files)public java.applet.AudioClip getAudioClip()