Methods Summary |
---|
protected java.lang.String | formatWithTimeZone(java.lang.String template, java.lang.Object[] arguments, java.util.Locale locale, java.util.TimeZone timezone)
MessageFormat mf = new MessageFormat(" ");
mf.setLocale(locale);
mf.applyPattern(template);
if (!timezone.equals(TimeZone.getDefault()))
{
Format[] formats = mf.getFormats();
for (int i = 0; i < formats.length; i++)
{
if (formats[i] instanceof DateFormat)
{
DateFormat temp = (DateFormat) formats[i];
temp.setTimeZone(timezone);
mf.setFormat(i,temp);
}
}
}
return mf.format(arguments);
|
public java.lang.Object[] | getArguments()Returns an Object[] containing the message arguments.
return arguments;
|
public java.lang.String | getEntry(java.lang.String key, java.util.Locale loc, java.util.TimeZone timezone)Reads the entry id + "." + key from the resource file and returns a
formated message for the given Locale and TimeZone.
String entry = id + "." + key;
try
{
ResourceBundle bundle = ResourceBundle.getBundle(resource,loc);
String template = bundle.getString(entry);
if (arguments == null || arguments.length == 0)
{
return template;
}
else
{
return formatWithTimeZone(template,filteredArguments,loc,timezone);
}
}
catch (MissingResourceException mre)
{
throw new MissingEntryException("Can't find entry " + entry + " in resource file " + resource + ".",
resource,
entry);
}
|
public org.bouncycastle.i18n.filter.Filter | getFilter()Returns the current filter.
return filter;
|
public java.lang.String | getId()Returns the id of the message in the resource bundle.
return id;
|
public java.lang.String | getResource()Returns the name of the resource bundle for this message
return resource;
|
public void | setFilter(org.bouncycastle.i18n.filter.Filter filter)Sets the {@link Filter} that is used to filter the arguments of this message
if (filter == null)
{
filteredArguments = arguments;
}
else if (!filter.equals(this.filter))
{
filteredArguments = new Object[arguments.length];
for (int i = 0; i < arguments.length; i++)
{
if (arguments[i] instanceof UntrustedInput)
{
filteredArguments[i] = filter.doFilter(((UntrustedInput) arguments[i]).getString());
}
else
{
filteredArguments[i] = arguments[i];
}
}
}
this.filter = filter;
|