diff options
author | Emil Ivov <emcho@jitsi.org> | 2007-02-22 12:34:55 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2007-02-22 12:34:55 +0000 |
commit | a9ee6044609d9a367f3794c97976d8cf08f5c40f (patch) | |
tree | ea2f7478db992ae0ed734943f6da4308219c9a98 /src/net/java/sip/communicator/plugin | |
parent | 7ab2c1ab3db1fecbb5f34ea3446a8f9b4730fec3 (diff) | |
download | jitsi-a9ee6044609d9a367f3794c97976d8cf08f5c40f.zip jitsi-a9ee6044609d9a367f3794c97976d8cf08f5c40f.tar.gz jitsi-a9ee6044609d9a367f3794c97976d8cf08f5c40f.tar.bz2 |
Added multichat operation set definition and Gibberish protocol implementation. Related issues: Issue #241 , Issue #244, Issue #250
Gibberish acc wizard resource handler
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
-rw-r--r-- | src/net/java/sip/communicator/plugin/gibberishaccregwizz/Resources.java | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/Resources.java new file mode 100644 index 0000000..7af4297 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/Resources.java @@ -0,0 +1,94 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + +package net.java.sip.communicator.plugin.gibberishaccregwizz; + +import java.io.*; +import java.util.*; + +import net.java.sip.communicator.util.*; + +/** + * The Messages class manages the access to the internationalization + * properties files. + * + * @author Emil Ivov + */ +public class Resources +{ + + private static Logger log = Logger.getLogger(Resources.class); + + private static final String BUNDLE_NAME + = "net.java.sip.communicator.plugin.gibberishaccregwizz.resources"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + public static ImageID GIBBERISH_LOGO = new ImageID("protocolIcon"); + + /** + * Returns an internationalized string corresponding to the given key. + * @param key The key of the string. + * @return An internationalized string corresponding to the given key. + */ + public static String getString(String key) + { + try + { + return RESOURCE_BUNDLE.getString(key); + + } + catch (MissingResourceException exc) + { + return '!' + key + '!'; + } + } + + /** + * Loads an image from a given image identifier. + * @param imageID The identifier of the image. + * @return The image for the given identifier. + */ + public static byte[] getImage(ImageID imageID) + { + byte[] image = new byte[100000]; + + String path = Resources.getString(imageID.getId()); + try + { + Resources.class.getClassLoader() + .getResourceAsStream(path).read(image); + + } + catch (IOException exc) + { + log.error("Failed to load image:" + path, exc); + } + + return image; + } + + /** + * Represents the Image Identifier. + */ + public static class ImageID + { + private String id; + + private ImageID(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + } + +} |