Fix bug in base64 encoder

This commit is contained in:
Alexey Andreev 2017-11-26 20:18:39 +03:00
parent a39e6eb47e
commit f14990eaeb

View File

@ -118,9 +118,9 @@ public final class Base64Impl {
int j; int j;
for (j = 0; j < triples;) { for (j = 0; j < triples;) {
output[i++] = encode((byte) (data[j] >>> 2)); output[i++] = encode((byte) (data[j] >>> 2));
output[i++] = encode((byte) ((data[j] << 4) | (data[j + 1] >>> 4))); output[i++] = encode((byte) ((data[j] << 4) | ((data[j + 1] & 0xFF) >>> 4)));
++j; ++j;
output[i++] = encode((byte) ((data[j] << 2) | (data[j + 1] >>> 6))); output[i++] = encode((byte) ((data[j] << 2) | ((data[j + 1] & 0xFF) >>> 6)));
++j; ++j;
output[i++] = encode(data[j]); output[i++] = encode(data[j]);
++j; ++j;