Permalink
Browse files

[JENKINS-45915] - Switch to the Java8 Base64 rather than Apache commo…

…ns (#2958)
  • Loading branch information...
svanoort authored and oleg-nenashev committed Aug 3, 2017
1 parent c90bfe4 commit 7550d796b36511b8f30efbe5f617016c4930dbf9
Showing with 3 additions and 3 deletions.
  1. +3 −3 core/src/main/java/hudson/util/UnbufferedBase64InputStream.java
@@ -1,11 +1,10 @@
package hudson.util;

import org.apache.commons.codec.binary.Base64;

import java.io.DataInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;

/**
* Filter InputStream that decodes base64 without doing any buffering.
@@ -22,6 +21,7 @@
private byte[] decoded;
private int pos;
private final DataInputStream din;
private static final Base64.Decoder decoder = Base64.getMimeDecoder();

public UnbufferedBase64InputStream(InputStream in) {
super(in);
@@ -38,7 +38,7 @@ public int read() throws IOException {

if (pos==decoded.length) {
din.readFully(encoded);
decoded = Base64.decodeBase64(encoded);
decoded = decoder.decode(encoded);
if (decoded.length==0) return -1; // EOF
pos = 0;
}

0 comments on commit 7550d79

Please sign in to comment.