01: package org.bouncycastle.i18n;
02:
03: import java.io.UnsupportedEncodingException;
04: import java.util.Locale;
05: import java.util.TimeZone;
06:
07: public class TextBundle extends LocalizedMessage {
08:
09: /**
10: * text entry key
11: */
12: public static final String TEXT_ENTRY = "text";
13:
14: /**
15: * Constructs a new TextBundle using <code>resource</code> as the base name for the
16: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
17: * @param resource base name of the resource file
18: * @param id the id of the corresponding bundle in the resource file
19: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
20: */
21: public TextBundle(String resource, String id)
22: throws NullPointerException {
23: super (resource, id);
24: }
25:
26: /**
27: * Constructs a new TextBundle using <code>resource</code> as the base name for the
28: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
29: * @param resource base name of the resource file
30: * @param id the id of the corresponding bundle in the resource file
31: * @param encoding the encoding of the resource file
32: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
33: * @throws UnsupportedEncodingException if the encoding is not supported
34: */
35: public TextBundle(String resource, String id, String encoding)
36: throws NullPointerException, UnsupportedEncodingException {
37: super (resource, id, encoding);
38: }
39:
40: /**
41: * Constructs a new TextBundle using <code>resource</code> as the base name for the
42: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
43: * @param resource base name of the resource file
44: * @param id the id of the corresponding bundle in the resource file
45: * @param arguments an array containing the arguments for the message
46: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
47: */
48: public TextBundle(String resource, String id, Object[] arguments)
49: throws NullPointerException {
50: super (resource, id, arguments);
51: }
52:
53: /**
54: * Constructs a new TextBundle using <code>resource</code> as the base name for the
55: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
56: * @param resource base name of the resource file
57: * @param id the id of the corresponding bundle in the resource file
58: * @param encoding the encoding of the resource file
59: * @param arguments an array containing the arguments for the message
60: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
61: * @throws UnsupportedEncodingException if the encoding is not supported
62: */
63: public TextBundle(String resource, String id, String encoding,
64: Object[] arguments) throws NullPointerException,
65: UnsupportedEncodingException {
66: super (resource, id, encoding, arguments);
67: }
68:
69: /**
70: * Returns the text message in the given locale and timezone.
71: * @param loc the {@link Locale}
72: * @param timezone the {@link TimeZone}
73: * @return the text message.
74: * @throws MissingEntryException if the message is not available
75: */
76: public String getText(Locale loc, TimeZone timezone)
77: throws MissingEntryException {
78: return getEntry(TEXT_ENTRY, loc, timezone);
79: }
80:
81: /**
82: * Returns the text message in the given locale and the defaut timezone.
83: * @param loc the {@link Locale}
84: * @return the text message.
85: * @throws MissingEntryException if the message is not available
86: */
87: public String getText(Locale loc) throws MissingEntryException {
88: return getEntry(TEXT_ENTRY, loc, TimeZone.getDefault());
89: }
90:
91: }
|