You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dl...@apache.org on 2002/03/07 23:38:19 UTC
cvs commit: jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/base64 Base64.java
dlr 02/03/07 14:38:19
Modified: codec/src/java/org/apache/commons/codec/base64 Base64.java
Log:
John McNally <jm...@collab.net> pointed out that this class has no
public interface (and should).
Revision Changes Path
1.3 +13 -13 jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/base64/Base64.java
Index: Base64.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/base64/Base64.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- Base64.java 28 Jan 2002 05:00:16 -0000 1.2
+++ Base64.java 7 Mar 2002 22:38:19 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/base64/Base64.java,v 1.2 2002/01/28 05:00:16 sanders Exp $
- * $Revision: 1.2 $
- * $Date: 2002/01/28 05:00:16 $
+ * $Header: /home/cvs/jakarta-commons-sandbox/codec/src/java/org/apache/commons/codec/base64/Base64.java,v 1.3 2002/03/07 22:38:19 dlr Exp $
+ * $Revision: 1.3 $
+ * $Date: 2002/03/07 22:38:19 $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -71,9 +71,9 @@
* 1996. Available at: http://www.ietf.org/rfc/rfc2045.txt
* </p>
* @author Jeffrey Rodriguez
- * @version $Revision: 1.2 $ $Date: 2002/01/28 05:00:16 $
+ * @version $Revision: 1.3 $ $Date: 2002/03/07 22:38:19 $
*/
-final class Base64 {
+public final class Base64 {
static private final int BASELENGTH = 255;
static private final int LOOKUPLENGTH = 64;
@@ -119,24 +119,24 @@
}
- static boolean isBase64(String isValidString) {
- return (isArrayByteBase64(isValidString.getBytes()));
+ public static boolean isBase64(String isValidString) {
+ return (isBase64(isValidString.getBytes()));
}
- static boolean isBase64(byte octect) {
+ public static boolean isBase64(byte octect) {
// Should we ignore white space?
return (octect == PAD || base64Alphabet[octect] != -1);
}
- static boolean isArrayByteBase64(byte[] arrayOctect) {
+ public static boolean isBase64(byte[] arrayOctect) {
int length = arrayOctect.length;
if (length == 0) {
return true;
}
for (int i = 0; i < length; i++) {
- if (Base64.isBase64(arrayOctect[i]) == false)
+ if (!Base64.isBase64(arrayOctect[i]))
return false;
}
return true;
@@ -148,7 +148,7 @@
* @param binaryData Array containing binaryData
* @return Base64-encoded array
*/
- static byte[] encode(byte[] binaryData) {
+ public static byte[] encode(byte[] binaryData) {
int lengthDataBits = binaryData.length * EIGHTBIT;
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
@@ -161,7 +161,7 @@
else // 16 or 8 bit
encodedData = new byte[numberTriplets * 4];
- byte k = 0, l = 0, b1 = 0,b2 = 0,b3 = 0;
+ byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
int encodedIndex = 0;
int dataIndex = 0;
@@ -223,7 +223,7 @@
* @param binaryData Byte array containing Base64 data
* @return Array containing decoded data.
*/
- static byte[] decode(byte[] base64Data) {
+ public static byte[] decode(byte[] base64Data) {
// Should we throw away anything not in base64Data ?
// handle the edge case, so we don't have to worry about it later
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>