Polishing

This commit is contained in:
Juergen Hoeller
2015-12-11 21:56:26 +01:00
parent 356eaef20e
commit 0968e47b04
3 changed files with 18 additions and 14 deletions

View File

@@ -18,7 +18,6 @@ package org.springframework.util;
import java.nio.charset.Charset;
import java.util.Base64;
import javax.xml.bind.DatatypeConverter;
import org.springframework.lang.UsesJava8;
@@ -106,6 +105,7 @@ public abstract class Base64Utils {
* @return the encoded byte array (or {@code null} if the input was {@code null})
* @throws IllegalStateException if Base64 encoding between byte arrays is not
* supported, i.e. neither Java 8 nor Apache Commons Codec is present at runtime
* @since 4.2.4
*/
public static byte[] encodeUrlSafe(byte[] src) {
assertDelegateAvailable();
@@ -119,6 +119,7 @@ public abstract class Base64Utils {
* @return the original byte array (or {@code null} if the input was {@code null})
* @throws IllegalStateException if Base64 encoding between byte arrays is not
* supported, i.e. neither Java 8 nor Apache Commons Codec is present at runtime
* @since 4.2.4
*/
public static byte[] decodeUrlSafe(byte[] src) {
assertDelegateAvailable();
@@ -252,9 +253,11 @@ public abstract class Base64Utils {
static class CommonsCodecBase64Delegate implements Base64Delegate {
private final org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64();
private final org.apache.commons.codec.binary.Base64 base64 =
new org.apache.commons.codec.binary.Base64();
private final org.apache.commons.codec.binary.Base64 base64UrlSafe = new org.apache.commons.codec.binary.Base64(0, null, true);
private final org.apache.commons.codec.binary.Base64 base64UrlSafe =
new org.apache.commons.codec.binary.Base64(0, null, true);
@Override
public byte[] encode(byte[] src) {