All getBytes("UTF-8") -> StringUtils
[nikiroo-utils.git] / src / be / nikiroo / utils / streams / Base64.java
index 76b4be49f731e9b2ee1387b0a3190fe9555dbd34..d54794b0a4ee2284bb1c691cb329aa52dd65fb47 100644 (file)
@@ -23,6 +23,8 @@ package be.nikiroo.utils.streams;
 
 import java.io.UnsupportedEncodingException;
 
+import be.nikiroo.utils.StringUtils;
+
 /**
  * Utilities for encoding and decoding the Base64 representation of
  * binary data.  See RFCs <a
@@ -120,12 +122,7 @@ class Base64 {
      * incorrect padding
      */
     public static byte[] decode(String str, int flags) {
-       try{
-               return decode(str.getBytes("UTF-8"), flags);
-       } catch (UnsupportedEncodingException e) {
-               // All conforming JVM are expected to support UTF-8
-               return null;
-       }
+               return decode(StringUtils.getBytes(str), flags);
     }
 
     /**