Package net.sf.okapi.common
Class Base64Util
- java.lang.Object
-
- net.sf.okapi.common.Base64Util
-
public class Base64Util extends Object
Base64 Encoder/Decoder utilities.
-
-
Constructor Summary
Constructors Constructor Description Base64Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdecodePassword(String password)Decode a string value that is possibly encoded into a clear string.static StringdecodeString(String str)Decodes a string from a UTF-8 Base64 string.static Stringencode(InputStream is)static StringencodePassword(String password)Encode a password-type string value.static StringencodeString(String str)Encodes a string into UTF-8 Base64 format.
-
-
-
Method Detail
-
encodeString
public static String encodeString(String str)
Encodes a string into UTF-8 Base64 format. No blanks or line breaks are inserted.- Parameters:
str- the String to be encoded.- Returns:
- the String with the Base64 encoded data.
-
decodeString
public static String decodeString(String str)
Decodes a string from a UTF-8 Base64 string. The coded string may have line breaks.- Parameters:
str- the Base64 String to be decoded.- Returns:
- the String containing the decoded data.
- Throws:
IllegalArgumentException- if the input is not valid Base64 encoded data.
-
encode
public static String encode(InputStream is)
-
encodePassword
public static String encodePassword(String password)
Encode a password-type string value.- Parameters:
password- the password (in clear).- Returns:
- the masked value for the given string.
- See Also:
decodePassword(String)
-
-