TOOLS: SDBLIB: Supported character set encoding in the Log View user can manually...
[sdk/ide/common-eplugin.git] / org.tizen.common.sdblib / src / org / tizen / sdblib / SdbHelper.java
index 778176a..02c6d0d 100755 (executable)
@@ -76,7 +76,7 @@ public class SdbHelper {
     {
        return str.getBytes( UTF_CHARSET );
     }
-    
+
     /**
      * convert bytes to string
      * 
@@ -92,7 +92,51 @@ public class SdbHelper {
     {
        return new String( bytes, UTF_CHARSET );
     }
-    
+
+    /**
+     * convert string to bytes
+     * 
+     * @param str string to convert
+     * 
+     * @param str characterSet character set used to convert 
+     * 
+     * @return bytes to be converted
+     * 
+     * @throws UnsupportedEncodingException If decoding fail
+     */
+    public static
+    byte[]
+    string2bytes(
+        final String str,
+        final String characterSet
+    )
+    throws UnsupportedEncodingException
+    {
+        return str.getBytes( characterSet );
+    }
+
+    /**
+     * convert bytes to string
+     * 
+     * @param bytes byte[] to convert
+     * 
+     * @param str characterSet character set used to convert 
+     * 
+     * @return string to be converted
+     * 
+     * @throws UnsupportedEncodingException If encoding fail
+     */
+    public static
+    String
+    bytes2string(
+        final byte[] bytes,
+        final String characterSet
+    )
+    throws UnsupportedEncodingException
+    {
+        return new String( bytes, characterSet );
+    }
+
     /**
      * Return {@code true} if subsequence is equal
      *