mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-16 20:24:04 +00:00
Added support for base64Encode
This commit is contained in:
@@ -302,9 +302,21 @@ public abstract class Strman {
|
||||
* @return decoded data
|
||||
*/
|
||||
public static String base64Decode(final String value) {
|
||||
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
|
||||
return new String(Base64.getDecoder().decode(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes data with MIME base64.
|
||||
*
|
||||
* @param value The data to encode
|
||||
* @return The encoded String
|
||||
*/
|
||||
public static String base64Encode(final String value) {
|
||||
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
|
||||
return Base64.getEncoder().encodeToString(value.getBytes());
|
||||
}
|
||||
|
||||
private static long countSubstr(String value, String subStr, boolean allowOverlapping, long count) {
|
||||
int position = value.indexOf(subStr);
|
||||
if (position == -1) {
|
||||
|
||||
Reference in New Issue
Block a user