aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/util/GuiUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/util/GuiUtils.java')
-rw-r--r--src/net/java/sip/communicator/util/GuiUtils.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/util/GuiUtils.java b/src/net/java/sip/communicator/util/GuiUtils.java
index 4bcdd6f..ace1efe 100644
--- a/src/net/java/sip/communicator/util/GuiUtils.java
+++ b/src/net/java/sip/communicator/util/GuiUtils.java
@@ -9,8 +9,10 @@ package net.java.sip.communicator.util;
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
+import java.io.*;
import java.util.*;
+import javax.imageio.*;
import javax.swing.*;
/**
@@ -24,6 +26,11 @@ import javax.swing.*;
public class GuiUtils
{
/**
+ * The logger for this class.
+ */
+ private static Logger logger = Logger.getLogger(GuiUtils.class);
+
+ /**
* List of all windows owned by the app.
*/
private static final ArrayList<Window> WINDOW_LIST
@@ -498,4 +505,25 @@ public class GuiUtils
}
}
}
+
+ /**
+ * Loads an image from a given bytes array.
+ * @param imageBytes The bytes array to load the image from.
+ * @return The image for the given bytes array.
+ */
+ public static Image getBytesInImage(byte[] imageBytes)
+ {
+ Image image = null;
+ try
+ {
+ image = ImageIO.read(
+ new ByteArrayInputStream(imageBytes));
+
+ }
+ catch (Exception e)
+ {
+ logger.error("Failed to convert bytes to image.", e);
+ }
+ return image;
+ }
}