Top Inners Fields Constructors Methods
org.bouncycastle.i18n

public Class LocalizedMessage

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.i18n.TextBundle, org.bouncycastle.i18n.LocaleString
Imports
java.io.UnsupportedEncodingException, java.nio.charset.Charset, java.text.DateFormat, .Format, .MessageFormat, java.util.Locale, .MissingResourceException, .ResourceBundle, .TimeZone, org.bouncycastle.i18n.filter.Filter, .TrustedInput, .UntrustedInput, .UntrustedUrlInput

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
protected LocalizedMessage.FilteredArguments
public static final String
protected String
protected LocalizedMessage.FilteredArguments
protected Filter
protected final String
protected ClassLoader
protected final String

Constructor Summary

AccessConstructor and Description
public
LocalizedMessage(String
base name of the resource file
resource
,
String
the id of the corresponding bundle in the resource file
id
)

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

public
LocalizedMessage(String
base name of the resource file
resource
,
String
the id of the corresponding bundle in the resource file
id
,
String
the encoding of the resource file
encoding
)

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

public
LocalizedMessage(String
base name of the resource file
resource
,
String
the id of the corresponding bundle in the resource file
id
,
Object[]
an array containing the arguments for the message
arguments
)

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

public
LocalizedMessage(String
base name of the resource file
resource
,
String
the id of the corresponding bundle in the resource file
id
,
String
the encoding of the resource file
encoding
,
Object[]
an array containing the arguments for the message
arguments
)

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

Method Summary

Modifier and TypeMethod and Description
protected String
addExtraArgs(String msg, Locale locale)

protected String
formatWithTimeZone(String template, Object[] arguments, Locale locale, TimeZone timezone)

public Object[]

Returns:

the message arguments
getArguments
()

Returns an Object[] containing the message arguments.

public ClassLoader

Returns:

the ClassLoader which loads the resource files
getClassLoader
()

Returns the ClassLoader which loads the resource files or null if the default ClassLoader is used.

public String

Returns:

a Strng containing the localized message
getEntry
(String
second part of the entry id
key
,
Locale
the used Locale
loc
,
TimeZone
the used TimeZone
timezone
)

Reads the entry id + "." + key from the resource file and returns a formated message for the given Locale and TimeZone.

public Object[]
public Filter

Returns:

the current filter
getFilter
()

Returns the current filter.

public String

Returns:

the id of the message
getId
()

Returns the id of the message in the resource bundle.

public String

Returns:

name of the resource file
getResource
()

Returns the name of the resource bundle for this message

public void
setClassLoader(ClassLoader
the ClassLoader which loads the resource files
loader
)

Set the ClassLoader which loads the resource files.

public void
public void
public void
setFilter(Filter
the Filter to use. null to disable filtering.
filter
)

Sets the Filter that is used to filter the arguments of this message

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

argumentsback to summary
protected LocalizedMessage.FilteredArguments arguments
DEFAULT_ENCODINGback to summary
public static final String DEFAULT_ENCODING
encodingback to summary
protected String encoding
extraArgsback to summary
protected LocalizedMessage.FilteredArguments extraArgs
filterback to summary
protected Filter filter
idback to summary
protected final String id
loaderback to summary
protected ClassLoader loader
resourceback to summary
protected final String resource

Constructor Detail

LocalizedMessageback to summary
public LocalizedMessage(String resource, String id) throws NullPointerException

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

Parameters
resource:String

base name of the resource file

id:String

the id of the corresponding bundle in the resource file

Exceptions
NullPointerException:
if resource or id is null
LocalizedMessageback to summary
public LocalizedMessage(String resource, String id, String encoding) throws NullPointerException, UnsupportedEncodingException

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

Parameters
resource:String

base name of the resource file

id:String

the id of the corresponding bundle in the resource file

encoding:String

the encoding of the resource file

Exceptions
NullPointerException:
if resource or id is null
UnsupportedEncodingException:
if the encoding is not supported
LocalizedMessageback to summary
public LocalizedMessage(String resource, String id, Object[] arguments) throws NullPointerException

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

Parameters
resource:String

base name of the resource file

id:String

the id of the corresponding bundle in the resource file

arguments:Object[]

an array containing the arguments for the message

Exceptions
NullPointerException:
if resource or id is null
LocalizedMessageback to summary
public LocalizedMessage(String resource, String id, String encoding, Object[] arguments) throws NullPointerException, UnsupportedEncodingException

Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.

Parameters
resource:String

base name of the resource file

id:String

the id of the corresponding bundle in the resource file

encoding:String

the encoding of the resource file

arguments:Object[]

an array containing the arguments for the message

Exceptions
NullPointerException:
if resource or id is null
UnsupportedEncodingException:
if the encoding is not supported

Method Detail

addExtraArgsback to summary
protected String addExtraArgs(String msg, Locale locale)
formatWithTimeZoneback to summary
protected String formatWithTimeZone(String template, Object[] arguments, Locale locale, TimeZone timezone)
getArgumentsback to summary
public Object[] getArguments()

Returns an Object[] containing the message arguments.

Returns:Object[]

the message arguments

getClassLoaderback to summary
public ClassLoader getClassLoader()

Returns the ClassLoader which loads the resource files or null if the default ClassLoader is used.

Returns:ClassLoader

the ClassLoader which loads the resource files

getEntryback to summary
public String getEntry(String key, Locale loc, TimeZone timezone) throws MissingEntryException

Reads the entry id + "." + key from the resource file and returns a formated message for the given Locale and TimeZone.

Parameters
key:String

second part of the entry id

loc:Locale

the used Locale

timezone:TimeZone

the used TimeZone

Returns:String

a Strng containing the localized message

Exceptions
MissingEntryException:
if the resource file is not available or the entry does not exist.
getExtraArgsback to summary
public Object[] getExtraArgs()
getFilterback to summary
public Filter getFilter()

Returns the current filter.

Returns:Filter

the current filter

getIdback to summary
public String getId()

Returns the id of the message in the resource bundle.

Returns:String

the id of the message

getResourceback to summary
public String getResource()

Returns the name of the resource bundle for this message

Returns:String

name of the resource file

setClassLoaderback to summary
public void setClassLoader(ClassLoader loader)

Set the ClassLoader which loads the resource files. If it is set to null then the default ClassLoader is used.

Parameters
loader:ClassLoader

the ClassLoader which loads the resource files

setExtraArgumentback to summary
public void setExtraArgument(Object extraArg)
setExtraArgumentsback to summary
public void setExtraArguments(Object[] extraArgs)
setFilterback to summary
public void setFilter(Filter filter)

Sets the Filter that is used to filter the arguments of this message

Parameters
filter:Filter

the Filter to use. null to disable filtering.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

org.bouncycastle.i18n back to summary

protected Class LocalizedMessage.FilteredArguments

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
protected int[]
protected Object[]
protected static final int
protected Filter
protected static final int
protected Object[]
protected boolean[]
protected static final int
protected Object[]

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
private Object
filter(int type, Object obj)

public Object[]
public Filter
public Object[]
public boolean
public void
setFilter(Filter filter)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argFilterTypeback to summary
protected int[] argFilterType
argumentsback to summary
protected Object[] arguments
FILTERback to summary
protected static final int FILTER
filterback to summary
protected Filter filter
FILTER_URLback to summary
protected static final int FILTER_URL
filteredArgsback to summary
protected Object[] filteredArgs
isLocaleSpecificback to summary
protected boolean[] isLocaleSpecific
NO_FILTERback to summary
protected static final int NO_FILTER
unpackedArgsback to summary
protected Object[] unpackedArgs

Constructor Detail

FilteredArgumentsback to summary
pack-priv FilteredArguments()
FilteredArgumentsback to summary
pack-priv FilteredArguments(Object[] args)

Method Detail

filterback to summary
private Object filter(int type, Object obj)
getArgumentsback to summary
public Object[] getArguments()
getFilterback to summary
public Filter getFilter()
getFilteredArgsback to summary
public Object[] getFilteredArgs(Locale locale)
isEmptyback to summary
public boolean isEmpty()
setFilterback to summary
public void setFilter(Filter filter)