Skip to content

Commit

Permalink
[JENKINS-45915] - Switch to the Java8 Base64 rather than Apache commo…
Browse files Browse the repository at this point in the history
…ns (#2958)
  • Loading branch information
svanoort authored and oleg-nenashev committed Aug 3, 2017
1 parent c90bfe4 commit 7550d79
Showing 1 changed file with 3 additions and 3 deletions.
@@ -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.
Expand All @@ -22,6 +21,7 @@ public class UnbufferedBase64InputStream extends FilterInputStream {
private byte[] decoded;
private int pos;
private final DataInputStream din;
private static final Base64.Decoder decoder = Base64.getMimeDecoder();

public UnbufferedBase64InputStream(InputStream in) {
super(in);
Expand All @@ -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;
}
Expand Down

0 comments on commit 7550d79

Please sign in to comment.