Skip to content

Commit 504809a

Browse files
authored
Merge pull request #9 from bennu/feat/base64-utils
feat: base64 utils
2 parents 78ab1a6 + 2bb48e1 commit 504809a

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can pull it from the central Maven repositories:
2020
<dependency>
2121
<groupId>cl.bennu</groupId>
2222
<artifactId>commons</artifactId>
23-
<version>1.0.0</version>
23+
<version>1.1.0</version>
2424
</dependency>
2525
```
2626

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>cl.bennu</groupId>
99
<artifactId>commons</artifactId>
10-
<version>1.0.0</version>
10+
<version>1.1.0</version>
1111
<name>bennu-commons</name>
1212
<description>Utilitarios bennu</description>
1313
<url>https://github.com/bennu/commons</url>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package cl.bennu.commons.utils;
2+
3+
public class Base64Util {
4+
public static String encode(String value) {
5+
return java.util.Base64.getEncoder().encodeToString(value.getBytes());
6+
}
7+
8+
public static byte[] decode(String value) {
9+
return java.util.Base64.getDecoder().decode(value);
10+
}
11+
12+
public static byte[] decode(byte[] value) {
13+
return java.util.Base64.getDecoder().decode(value);
14+
}
15+
16+
public static String decodeToString(String value) {
17+
return new String(java.util.Base64.getDecoder().decode(value));
18+
}
19+
}

0 commit comments

Comments
 (0)