am eaa2cabf
: Merge "Fix problem where Base64InputStream single-byte reads were unsigned." into gingerbread
Merge commit 'eaa2cabf342e973925fb223104f9971deae27b17' into gingerbread-plus-aosp * commit 'eaa2cabf342e973925fb223104f9971deae27b17': Fix problem where Base64InputStream single-byte reads were unsigned.
This commit is contained in:
@ -112,7 +112,7 @@ public class Base64InputStream extends FilterInputStream {
|
|||||||
if (outputStart >= outputEnd) {
|
if (outputStart >= outputEnd) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return coder.output[outputStart++];
|
return coder.output[outputStart++] & 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package android.util;
|
package android.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -404,6 +407,14 @@ public class Base64Test extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** http://b/3026478 */
|
||||||
|
public void testSingleByteReads() throws IOException {
|
||||||
|
InputStream in = new Base64InputStream(
|
||||||
|
new ByteArrayInputStream("/v8=".getBytes()), Base64.DEFAULT);
|
||||||
|
assertEquals(254, in.read());
|
||||||
|
assertEquals(255, in.read());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that Base64OutputStream produces exactly the same results
|
* Tests that Base64OutputStream produces exactly the same results
|
||||||
* as calling Base64.encode/.decode on an in-memory array.
|
* as calling Base64.encode/.decode on an in-memory array.
|
||||||
|
Reference in New Issue
Block a user