summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-02-08 09:06:41 -0800
committerDoug Zongker <dougz@android.com>2010-02-08 11:16:20 -0800
commit8799149974cb4ef9a0ad9ab0de5a516e8eb7f542 (patch)
tree834403224f8229dc796f2bc481a77d842c6aae5f /common
parent5d36c46d2d8fb3f1bdc8fd1ff407e14b4433272a (diff)
downloadframeworks_base-8799149974cb4ef9a0ad9ab0de5a516e8eb7f542.zip
frameworks_base-8799149974cb4ef9a0ad9ab0de5a516e8eb7f542.tar.gz
frameworks_base-8799149974cb4ef9a0ad9ab0de5a516e8eb7f542.tar.bz2
add explicit Base64.DEFAULT flag to request default behavior
Also fix some grammar problems in the javadoc, and prevent the class from being instantiated. Change-Id: I4d83184236566a1e77d5f5cce1c4dd3776bcfca3
Diffstat (limited to 'common')
-rw-r--r--common/java/com/android/common/Base64.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/common/java/com/android/common/Base64.java b/common/java/com/android/common/Base64.java
index 0c8e7c1..771875c 100644
--- a/common/java/com/android/common/Base64.java
+++ b/common/java/com/android/common/Base64.java
@@ -22,6 +22,11 @@ package com.android.common;
*/
public class Base64 {
/**
+ * Default values for encoder/decoder flags.
+ */
+ public static final int DEFAULT = 0;
+
+ /**
* Encoder flag bit to indicate you want the padding '='
* characters at the end (if any) to be omitted.
*/
@@ -106,7 +111,7 @@ public class Base64 {
* @param input the input String to decode, which is converted to
* bytes using the default charset
* @param flags controls certain features of the decoded output.
- * Passing 0 to decode standard Base64.
+ * Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException if the input contains
* incorrect padding
@@ -124,7 +129,7 @@ public class Base64 {
*
* @param input the input array to decode
* @param flags controls certain features of the decoded output.
- * Passing 0 to decode standard Base64.
+ * Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException if the input contains
* incorrect padding
@@ -144,7 +149,7 @@ public class Base64 {
* @param offset the position within the input array at which to start
* @param len the number of bytes of input to decode
* @param flags controls certain features of the decoded output.
- * Passing 0 to decode standard Base64.
+ * Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException if the input contains
* incorrect padding
@@ -362,8 +367,8 @@ public class Base64 {
*
* @param input the data to encode
* @param flags controls certain features of the encoded output.
- * Passing 0 results in output that adheres to RFC
- * 2045.
+ * Passing {@code DEFAULT} results in output that
+ * adheres to RFC 2045.
*/
public static String encodeToString(byte[] input, int flags) {
return new String(encode(input, flags));
@@ -378,8 +383,8 @@ public class Base64 {
* start
* @param len the number of bytes of input to encode
* @param flags controls certain features of the encoded output.
- * Passing 0 results in output that adheres to RFC
- * 2045.
+ * Passing {@code DEFAULT} results in output that
+ * adheres to RFC 2045.
*/
public static String encodeToString(byte[] input, int offset, int len, int flags) {
return new String(encode(input, offset, len, flags));
@@ -391,8 +396,8 @@ public class Base64 {
*
* @param input the data to encode
* @param flags controls certain features of the encoded output.
- * Passing 0 results in output that adheres to RFC
- * 2045.
+ * Passing {@code DEFAULT} results in output that
+ * adheres to RFC 2045.
*/
public static byte[] encode(byte[] input, int flags) {
return encode(input, 0, input.length, flags);
@@ -407,8 +412,8 @@ public class Base64 {
* start
* @param len the number of bytes of input to encode
* @param flags controls certain features of the encoded output.
- * Passing 0 results in output that adheres to RFC
- * 2045.
+ * Passing {@code DEFAULT} results in output that
+ * adheres to RFC 2045.
*/
public static byte[] encode(byte[] input, int offset, int len, int flags) {
final boolean do_padding = (flags & NO_PADDING) == 0;
@@ -494,4 +499,6 @@ public class Base64 {
assert op == output.length;
return output;
}
+
+ private Base64() { } // don't instantiate
}