public class Resources extends Object
Modifier and Type | Method and Description |
---|---|
InputStream |
getData(String id)
Returns the data resource from the file
|
String[] |
getDataResourceNames()
Returns the names of the data resources within this bundle
|
Font |
getFont(String id)
Returns the font resource from the file
|
String[] |
getFontResourceNames()
Returns the names of the fonts within this bundle
|
static Resources |
getGlobalResources()
Global resources are used by new GUI builder apps to keep track of the applications resources
|
Image |
getImage(String id)
Returns the image resource from the file
|
String[] |
getImageResourceNames()
Returns the names of the images within this bundle
|
Hashtable<String,String> |
getL10N(String id,
String locale)
Returns a hashmap containing localized String key/value pairs for the given locale name
|
String[] |
getL10NResourceNames()
Returns the names of the localization bundles within this bundle
|
int |
getMajorVersion()
Returns the version number for this resource file.
|
String[] |
getMetaData()
Returns optional meta-data associated with the resource file
|
int |
getMinorVersion()
Returns the minor version number for this resource file
This value relates to the value from the header defined by the resource file
specification.
|
String[] |
getResourceNames()
Returns the names of the resources within this bundle
|
static Resources |
getSystemResource()
Gets the system resource which can be located /CN1Images.res.
|
Hashtable |
getTheme(String id)
Returns the theme resource from the file
|
String[] |
getThemeResourceNames()
Returns the names of the images within this bundle
|
String[] |
getUIResourceNames()
Returns the names of the ui resources within this bundle
|
boolean |
isAnimation(String name)
Deprecated.
animations are no longer distinguished from images in the resource file, use Image.isAnimation instead
|
boolean |
isData(String name)
Returns true if this is a data resource
|
static boolean |
isEnableMediaQueries() |
static boolean |
isFailOnMissingTruetype() |
boolean |
isFont(String name)
Returns true if this is a font resource
|
boolean |
isImage(String name)
Returns true if this is an image resource
|
boolean |
isL10N(String name)
Returns true if this is a generic data resource
|
boolean |
isTheme(String name)
Returns true if this is a theme resource
|
boolean |
isUI(String name)
Returns true if this is a UI resource
|
Collection<String> |
l10NLocaleSet(String id)
Returns a collection of the l10 locale names
|
Enumeration |
listL10NLocales(String id)
Returns an enumration of the locales supported by this resource id
|
static Resources |
open(InputStream resource)
Creates a resource object from the given input stream
|
static Resources |
open(InputStream resource,
int dpi)
Creates a resource object from the given input stream
|
static Resources |
open(String resource)
Creates a resource object from the local JAR resource identifier
|
static Resources |
open(String resource,
int dpi)
Creates a resource object from the local JAR resource identifier
|
static Resources |
openLayered(String resource)
Opens a multi-layer resource file that supports overriding features on a specific
platform.
|
static Resources |
openLayered(String resource,
int dpi)
Opens a multi-layer resource file that supports overriding features on a specific
platform.
|
void |
override(InputStream input)
This method allows overriding the data of a resource file with another resource file thus replacing
or enhancing existing content with platform specific content.
|
static void |
setEnableMediaQueries(boolean enable) |
static void |
setFailOnMissingTruetype(boolean aFailOnMissingTruetype) |
static void |
setGlobalResources(Resources res)
Global resources are used by new GUI builder apps to keep track of the applications resources
|
static void |
setPassword(String password)
Sets the password to use for password protected resource files
|
static void |
setRuntimeMultiImageEnabled(boolean b)
Deprecated.
do not use this method!
|
public static boolean isFailOnMissingTruetype()
public static void setEnableMediaQueries(boolean enable)
public static boolean isEnableMediaQueries()
public static void setFailOnMissingTruetype(boolean aFailOnMissingTruetype)
aFailOnMissingTruetype
- the failOnMissingTruetype to setpublic static void setRuntimeMultiImageEnabled(boolean b)
public void override(InputStream input) throws IOException
input
- a new resource fileIOException
- exception thrown from the streampublic static void setPassword(String password)
password
- the password or null to clear the passwordpublic int getMajorVersion()
public int getMinorVersion()
public String[] getMetaData()
public String[] getResourceNames()
public String[] getDataResourceNames()
public String[] getUIResourceNames()
public String[] getL10NResourceNames()
public String[] getFontResourceNames()
public String[] getThemeResourceNames()
public String[] getImageResourceNames()
public boolean isL10N(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isTheme(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isFont(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isAnimation(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isData(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isUI(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic boolean isImage(String name)
name
- the name of the resourceNullPointerException
- if the resource doesn't existpublic static Resources openLayered(String resource) throws IOException
resource
- a local reference to a resource using the syntax of Class.getResourceAsStream(String)
however the extension MUST not be included in the name! E.g. to reference /x.res use /xIOException
- if opening/reading the resource failspublic static Resources open(String resource) throws IOException
resource
- a local reference to a resource using the syntax of Class.getResourceAsStream(String)IOException
- if opening/reading the resource failspublic static Resources open(InputStream resource) throws IOException
resource
- stream from which to read the resourceIOException
- if opening/reading the resource failspublic static Resources openLayered(String resource, int dpi) throws IOException
resource
- a local reference to a resource using the syntax of Class.getResourceAsStream(String)
however the extension MUST not be included in the name! E.g. to reference /x.res use /xdpi
- the dpi used for the loaded imagesIOException
- if opening/reading the resource failspublic static Resources open(String resource, int dpi) throws IOException
resource
- a local reference to a resource using the syntax of Class.getResourceAsStream(String)dpi
- the dpi used for the loaded imagesIOException
- if opening/reading the resource failspublic static Resources open(InputStream resource, int dpi) throws IOException
resource
- stream from which to read the resourcedpi
- the dpi used for the loaded imagesIOException
- if opening/reading the resource failspublic Image getImage(String id)
id
- name of the image resourcepublic InputStream getData(String id)
id
- name of the data resourcepublic Hashtable<String,String> getL10N(String id, String locale)
id
- the name of the locale resourcelocale
- name of the locale resourcepublic Enumeration listL10NLocales(String id)
id
- the name of the locale resourcepublic Collection<String> l10NLocaleSet(String id)
id
- the name of the locale resourcepublic Font getFont(String id)
id
- name of the font resourcepublic Hashtable getTheme(String id)
id
- name of the theme resourcepublic static Resources getSystemResource()
public static void setGlobalResources(Resources res)
res
- the resource object used by default in the GUI builder formspublic static Resources getGlobalResources()