Author: sebb
Date: Sat Oct 6 11:56:59 2012
New Revision: 1395016
URL: http://svn.apache.org/viewvc?rev=1395016&view=rev
Log:
Add static toString methods:
- encodeBase64String(byte[], boolean) : String
- encodeBase64StringUnChunked(byte[]) : String
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java?rev=1395016&r1=1395015&r2=1395016&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/Base64.java
Sat Oct 6 11:56:59 2012
@@ -647,7 +647,7 @@ public class Base64 {
/**
* Encodes binary data using the base64 algorithm into 76 character blocks
separated by CRLF.
* <p>
- * For a non-chunking version, see {@link #encodeToString(byte[])}.
+ * For a non-chunking version, see {@link
#encodeBase64StringUnChunked(byte[])}.
*
* @param binaryData
* binary data to encode
@@ -659,6 +659,33 @@ public class Base64 {
}
/**
+ * Encodes binary data using the base64 algorithm, without using chunking.
+ * <p>
+ * For a chunking version, see {@link #encodeBase64String(byte[])}.
+ *
+ * @param binaryData
+ * binary data to encode
+ * @return String containing Base64 characters.
+ * @since 3.2
+ */
+ public static String encodeBase64StringUnChunked(byte[] binaryData) {
+ return newStringUtf8(encodeBase64(binaryData, false));
+ }
+
+ /**
+ * Encodes binary data using the base64 algorithm.
+ *
+ * @param binaryData
+ * binary data to encode
+ * @param useChunking whether to split the output into chunks
+ * @return String containing Base64 characters.
+ * @since 3.2
+ */
+ public static String encodeBase64String(byte[] binaryData, boolean
useChunking) {
+ return newStringUtf8(encodeBase64(binaryData, useChunking));
+ }
+
+ /**
* Encodes binary data using a URL-safe variation of the base64 algorithm
but does not chunk the output. The
* url-safe variation emits - and _ instead of + and / characters.
*
@@ -895,8 +922,6 @@ public class Base64 {
/**
* Encodes a byte[] containing binary data, into a String containing
characters in the Base64 alphabet.
- * <p>
- * See also {@link #encodeBase64String(byte[])} which allows for chunking
the output.
*
* @param pArray
* a byte array containing binary data