Package org.bouncycastle.i18n
Class LocalizedMessage
java.lang.Object
org.bouncycastle.i18n.LocalizedMessage
- Direct Known Subclasses:
LocaleString,TextBundle
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LocalizedMessage.FilteredArgumentsstatic final Stringprotected Stringprotected LocalizedMessage.FilteredArgumentsprotected Filterprotected final Stringprotected ClassLoaderprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionLocalizedMessage(String resource, String id) Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.LocalizedMessage(String resource, String id, Object[] arguments) Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.LocalizedMessage(String resource, String id, String encoding) Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.LocalizedMessage(String resource, String id, String encoding, Object[] arguments) Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddExtraArgs(String msg, Locale locale) protected StringformatWithTimeZone(String template, Object[] arguments, Locale locale, TimeZone timezone) Object[]Returns anObject[]containing the message arguments.Returns theClassLoaderwhich loads the resource files ornullif the default ClassLoader is used.Reads the entryid + "." + keyfrom the resource file and returns a formated message for the given Locale and TimeZone.Object[]Returns the current filter.getId()Returns the id of the message in the resource bundle.Returns the name of the resource bundle for this messagevoidsetClassLoader(ClassLoader loader) Set theClassLoaderwhich loads the resource files.voidsetExtraArgument(Object extraArg) voidsetExtraArguments(Object[] extraArgs) voidSets theFilterthat is used to filter the arguments of this messagetoString()
-
Field Details
-
id
-
resource
-
DEFAULT_ENCODING
- See Also:
-
encoding
-
arguments
-
extraArgs
-
filter
-
loader
-
-
Constructor Details
-
LocalizedMessage
Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.- Parameters:
resource- base name of the resource fileid- the id of the corresponding bundle in the resource file- Throws:
NullPointerException- ifresourceoridisnull
-
LocalizedMessage
public LocalizedMessage(String resource, String id, String encoding) throws NullPointerException, UnsupportedEncodingException Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.- Parameters:
resource- base name of the resource fileid- the id of the corresponding bundle in the resource fileencoding- the encoding of the resource file- Throws:
NullPointerException- ifresourceoridisnullUnsupportedEncodingException- if the encoding is not supported
-
LocalizedMessage
Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.- Parameters:
resource- base name of the resource fileid- the id of the corresponding bundle in the resource filearguments- an array containing the arguments for the message- Throws:
NullPointerException- ifresourceoridisnull
-
LocalizedMessage
public LocalizedMessage(String resource, String id, String encoding, Object[] arguments) throws NullPointerException, UnsupportedEncodingException Constructs a new LocalizedMessage usingresourceas the base name for the RessourceBundle andidas the message bundle id the resource file.- Parameters:
resource- base name of the resource fileid- the id of the corresponding bundle in the resource fileencoding- the encoding of the resource filearguments- an array containing the arguments for the message- Throws:
NullPointerException- ifresourceoridisnullUnsupportedEncodingException- if the encoding is not supported
-
-
Method Details
-
getEntry
Reads the entryid + "." + keyfrom the resource file and returns a formated message for the given Locale and TimeZone.- Parameters:
key- second part of the entry idloc- the usedLocaletimezone- the usedTimeZone- Returns:
- a Strng containing the localized message
- Throws:
MissingEntryException- if the resource file is not available or the entry does not exist.
-
formatWithTimeZone
-
addExtraArgs
-
setFilter
Sets theFilterthat is used to filter the arguments of this message- Parameters:
filter- theFilterto use.nullto disable filtering.
-
getFilter
Returns the current filter.- Returns:
- the current filter
-
setClassLoader
Set theClassLoaderwhich loads the resource files. If it is set tonullthen the defaultClassLoaderis used.- Parameters:
loader- theClassLoaderwhich loads the resource files
-
getClassLoader
Returns theClassLoaderwhich loads the resource files ornullif the default ClassLoader is used.- Returns:
- the
ClassLoaderwhich loads the resource files
-
getId
Returns the id of the message in the resource bundle.- Returns:
- the id of the message
-
getResource
Returns the name of the resource bundle for this message- Returns:
- name of the resource file
-
getArguments
Returns anObject[]containing the message arguments.- Returns:
- the message arguments
-
setExtraArgument
- Parameters:
extraArg-
-
setExtraArguments
- Parameters:
extraArgs-
-
getExtraArgs
- Returns:
-
toString
-