Skip to content

Commit

Permalink
Drop deprecated libcore.io.Base64 in favor of java.util.Base64
Browse files Browse the repository at this point in the history
Move the last last remaining user (DropBox) of l.i.Base64.encode()
to j.u.Base64.getEncoder().encodeToString() which produces exactly
the same result.

The decoding behavior of the two implementations differ:
 - in case of error, l.i.Base64 returns null vs. j.u.Base64 throws
 - j.u.Base64 is more strict about forbidding extra in-stream or
   trailing characters
 - the two implementations differ in how many bytes they decode if
   the encoded data ends prematurely.
To document the behavior change, the old libcore.io.Base64Test was
kept with updated expectations and under a new name.

Bug: 31292683
Test: libcore.java.util.LibcoreIoDerivedBase64Test

Change-Id: I62d4731d38619629d72549430c57e07f8ea4aa1e
  • Loading branch information
15characterlimi committed Dec 2, 2016
1 parent 0e6a2b6 commit 92929ee
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 316 deletions.
266 changes: 0 additions & 266 deletions luni/src/main/java/libcore/io/Base64.java

This file was deleted.

4 changes: 3 additions & 1 deletion luni/src/main/java/libcore/io/DropBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package libcore.io;

import java.util.Base64;

public final class DropBox {

/**
Expand Down Expand Up @@ -54,7 +56,7 @@ public static interface Reporter {
private static final class DefaultReporter implements Reporter {

public void addData(String tag, byte[] data, int flags) {
System.out.println(tag + ": " + Base64.encode(data));
System.out.println(tag + ": " + Base64.getEncoder().encodeToString(data));
}

public void addText(String tag, String data) {
Expand Down
Loading

0 comments on commit 92929ee

Please sign in to comment.