1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

SMACK-404 Changed StringUtils.decodeBase64(String) behavior so that the method does not try to detect and decompress a gzip-compressed input. Refactored every use of the Base64.(de|en)code* methods to use the StringUtils (de|en)codeBase64 methods instead.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13416 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-01-29 22:49:20 +00:00 committed by flow
parent e3f84cdbe6
commit 401c37bd28
4 changed files with 19 additions and 10 deletions

View file

@ -501,12 +501,21 @@ public class StringUtils {
/**
* Decodes a base64 String.
* Unlike Base64.decode() this method does not try to detect and decompress a gzip-compressed input.
*
* @param data a base64 encoded String to decode.
* @return the decoded String.
*/
public static byte[] decodeBase64(String data) {
return Base64.decode(data);
byte[] bytes;
try {
bytes = data.getBytes("UTF-8");
} catch (java.io.UnsupportedEncodingException uee) {
bytes = data.getBytes();
}
bytes = Base64.decode(bytes, 0, bytes.length, Base64.NO_OPTIONS);
return bytes;
}
/**