ResourceSvc.I Interface

com.bea.ide.core
ResourceSvc.I Interface

public static interface ResourceSvc.I
Enclosing class

ResourceSvc

Method Summary

public String
findString(String sStringId)
Find a string by full ID.
public String
format(String sStringId, Object[] args)
Get a formatted string resource from full string ID.
public String
format(Class c, String file, String id, Object[] args)
Get a formatted string resource using same rules as resource pacakage e.g.
public Icon
getIcon(String sImageId)
Get an icon by full path.
public Image
getImage(String sImageId)
Get an image by full path.
public InputStream
getInputStream(String sResourcePath)
Obtain an input stream for the given resource.
public Reader
getReader(String sResourcePath)
Obtain a reader for a given resource.
public ResourceSvc.IResourcePkg
getResourcePackage(String sPrefix)
Get a resource package given a full path to the properties file (not including '.properties' extension) or a resource directory e.g.
public ResourceSvc.IResourcePkg
getResourcePackage(Object o, String file)
Get a resource package given an object and a properties file name (not including '.properties' extension).
public ResourceSvc.IResourcePkg
getResourcePackage(Class c, String file)
Get a resource package given a class and a properties file name (not including '.properties' extension).
public String
getString(String sStringId)
Get a string by full ID.
public String
getString(Class c, String file, String id)
Get a string using the class and properties file name This method derives the full package name as follows: strings.
public String
toOSSeparators(String str)
Converts all instances of '\n' to operating-system specific line endings.
public String
toOSSeparators(String str, boolean normalizeFirst)
Converts all newlines to operating-system specific line endings.

Method Detail

findString(String) Method

public String findString(String sStringId)
Find a string by full ID. Note that this method differs from getString in that it does not assert if the string cannot be found e.g. "strings.workshop.shell.dialog.file.Title"

Parameters

sStringId
full path to the string

Returns

the string obtained by loading the resource file and reading the corresponding string or null if either the file or string is not found.

format(String, Object[]) Method

public String format(String sStringId, 
                     Object[] args)
Get a formatted string resource from full string ID. e.g. "strings.workshop.shell.dialog.file.error1"

Parameters

sStringId
full string ID to format string
args
array of objects used in format string

Returns

formatted string resource

Related Topics

MessageFormat.format(String, Object[])


format(Class, String, String, Object[]) Method

public String format(Class c, 
                     String file, 
                     String id, 
                     Object[] args)
Get a formatted string resource using same rules as resource pacakage e.g. "strings..file.error1"

Parameters

c
class to obtain package information
file
string name of the properties file
id
name of string within the properties file
args
array of objects used in format string

Returns

formatted string resource

Related Topics

MessageFormat.format(String, Object[])


getIcon(String) Method

public Icon getIcon(String sImageId)
Get an icon by full path.

Parameters

sImageId
full path to icon

Returns

Icon the specified icon

getImage(String) Method

public Image getImage(String sImageId)
Get an image by full path.

Parameters

sImageId
full path to image

Returns

Image the specified image

getInputStream(String) Method

public InputStream getInputStream(String sResourcePath)
Obtain an input stream for the given resource.

Parameters

sResourcePath
a "/"-separated string that refers to a file in a jar on the classpath.

Returns

input stream for the given file or null if the path could not be found

getReader(String) Method

public Reader getReader(String sResourcePath)
Obtain a reader for a given resource. This essentially obtains an input stream and converts it to a Reader. The method calls FileSvc.get().getReaderForStream() which will attempt to determine the correct charset encoding to use. If you wish to use a custom encoding, call getInputStream and use the InputStreamReader class to convert it to a reader.

Parameters

sResourcePath
a "/"-separated string that refers to a file in a jar on the classpath.

Returns

input stream for the given file or null if the path could not be found

getResourcePackage(String) Method

public ResourceSvc.IResourcePkg getResourcePackage(String sPrefix)
Get a resource package given a full path to the properties file (not including '.properties' extension) or a resource directory e.g. "strings.workshop.shell.dialog.file"

Related Topics

ResourceSvc.IResourcePkg


getResourcePackage(Object, String) Method

public ResourceSvc.IResourcePkg getResourcePackage(Object o, 
                                                   String file)
Get a resource package given an object and a properties file name (not including '.properties' extension). This method inspects the Object to get a package name and derives the full package name as follows. strings..file

Related Topics

ResourceSvc.IResourcePkg


getResourcePackage(Class, String) Method

public ResourceSvc.IResourcePkg getResourcePackage(Class c, 
                                                   String file)
Get a resource package given a class and a properties file name (not including '.properties' extension). This method derives the full package name as follows: strings..file

Related Topics

ResourceSvc.IResourcePkg


getString(String) Method

public String getString(String sStringId)
Get a string by full ID. This method will assert if the string is not found. This will help catch cases where someone has left out a string. If it is possible to not have the string and still have a valid scenario, you should use findString instead. e.g. "strings.workshop.shell.dialog.file.Title"

Parameters

sStringId
full path to the string

Returns

the string obtained by loading the resource file and reading the corresponding string or null if the string or file cannot be found

getString(Class, String, String) Method

public String getString(Class c, 
                        String file, 
                        String id)
Get a string using the class and properties file name This method derives the full package name as follows: strings.<PACKAGE>.file.id

Parameters

c
class to obtain package information
file
string name of the properties file
id
name of string within the properties file

toOSSeparators(String) Method

public String toOSSeparators(String str)
Converts all instances of '\n' to operating-system specific line endings. It is the callers responsibility to ensure that the string provided has been correctly normalized.

Parameters

str
Normalized (containing only '\n' separators) string to be denormalized.

Returns

A copy of the string containing OS appropriate line separators.

toOSSeparators(String, boolean) Method

public String toOSSeparators(String str, 
                             boolean normalizeFirst)
Converts all newlines to operating-system specific line endings. If the normalize flag is set, the text will be normalized first.

Parameters

str
String to be denormalized.
normalizeFirst
True if the string should be normalized (anything that looks like a line end converted to \n) before converting to OS specific. This is a fairly expensive step, and should be avoided if the string is known to be normal already.

Returns

A copy of the string containing OS appropriate line separators.