File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
fj-doc-base/src/main/java/org/fugerit/java/doc/base/helper Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .base .helper ;
2+
3+ import org .apache .commons .codec .binary .Base64 ;
4+
5+ public class Base64Helper {
6+
7+ public static String encodeBase64String ( byte [] data ) {
8+ return Base64 .encodeBase64String ( data );
9+ }
10+
11+ public static byte [] decodeBase64String ( String data ) {
12+ return Base64 .decodeBase64 ( data );
13+ }
14+
15+ }
Original file line number Diff line number Diff line change 22
33import java .net .URL ;
44
5- import org .apache .commons .codec .binary .Base64 ;
65import org .fugerit .java .core .io .StreamIO ;
76import org .fugerit .java .core .io .helper .StreamHelper ;
87import org .fugerit .java .core .lang .helpers .StringUtils ;
@@ -23,7 +22,7 @@ public static String resolveImageToBase64( DocImage img ) throws Exception {
2322 URL url = new URL ( path );
2423 data = StreamIO .readBytes ( url .openConnection ().getInputStream () );
2524 }
26- base64 = Base64 .encodeBase64String ( data );
25+ base64 = Base64Helper .encodeBase64String ( data );
2726 } else {
2827 throw new Exception ( "Null path and base64 provided!" );
2928 }
@@ -35,7 +34,7 @@ public static byte[] resolveImage( DocImage img ) throws Exception {
3534 String path = img .getUrl ();
3635 String base64 = img .getBase64 ();
3736 if ( StringUtils .isNotEmpty ( base64 ) ) {
38- data = Base64 . decodeBase64 ( base64 );
37+ data = Base64Helper . decodeBase64String ( base64 );
3938 } else if ( path != null ) {
4039 if ( path .startsWith ( StreamHelper .PATH_CLASSLOADER ) ) {
4140 data = StreamIO .readBytes ( StreamHelper .resolveStream ( path ) );
You can’t perform that action at this time.
0 commit comments