@@ -323,22 +323,23 @@ public static String toBase64(@NotNull byte[] bytes, boolean padding) {
323323 Class <?> encoderClazz = Class .forName ("java.util.Base64$Encoder" );
324324 Object encoder = getEncoder .invoke (null );
325325 final Method withoutPadding = encoderClazz .getDeclaredMethod ("withoutPadding" );
326- if (!padding )
326+ if (!padding )
327327 encoder = withoutPadding .invoke (encoder );
328328 final Method encode = encoderClazz .getDeclaredMethod ("encode" , byte [].class );
329329 encodedBytes = (byte []) encode .invoke (encoder , bytes );
330- } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored ) {
330+ } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored ) {
331331 try {
332332 Class <?> clazz = Class .forName (ANDROID_UTIL_BASE_64 );
333333 final Method encode = clazz .getDeclaredMethod ("encode" , byte [].class , int .class );
334334 int flags = 2 ; // Base64.NO_WRAP
335- if (!padding )
335+ if (!padding )
336336 flags |= 1 ; // Base64.NO_PADDING
337337 encodedBytes = (byte []) encode .invoke (null , bytes , flags ); // Base64.NO_WRAP | Base64.NO_PADDING
338338 } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored2 ) {
339- throw new NoClassDefFoundError ("Base64 not available" );
339+ throw new NoClassDefFoundError ("Base64 not available" );
340340 }
341341 }
342+
342343 return new String (encodedBytes , StandardCharsets .UTF_8 );
343344 }
344345
@@ -367,7 +368,7 @@ public static byte[] fromBase64(@NotNull byte[] bytes) {
367368 Class <?> decoderClazz = Class .forName ("java.util.Base64$Decoder" );
368369 final Method decode = decoderClazz .getDeclaredMethod ("decode" , byte [].class );
369370 decodedBytes = (byte []) decode .invoke (decoder , bytes );
370- } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored ) {
371+ } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored ) {
371372 try {
372373 Class <?> clazz = Class .forName (ANDROID_UTIL_BASE_64 );
373374 final Method decode = clazz .getDeclaredMethod ("decode" , byte [].class , int .class );
@@ -377,6 +378,7 @@ public static byte[] fromBase64(@NotNull byte[] bytes) {
377378 throw new NoClassDefFoundError ("Base64 not available" );
378379 }
379380 }
381+
380382 return decodedBytes ;
381383 }
382384}
0 commit comments