You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/05/02 14:31:44 UTC
svn commit: r1677312 - in /webservices/axiom/trunk/modules/axiom-api/src:
main/java/org/apache/axiom/util/base64/Base64Utils.java
test/java/org/apache/axiom/util/base64/Base64UtilsTest.java
Author: veithen
Date: Sat May 2 12:31:44 2015
New Revision: 1677312
URL: http://svn.apache.org/r1677312
Log:
Schedule unused base64 codec code for removal. Other libraries do a better job than this code (see e.g. AXIOM-434) and we don't want to fix/maintain it if we don't use it ourselves.
Modified:
webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/base64/Base64UtilsTest.java
Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java?rev=1677312&r1=1677311&r2=1677312&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java (original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java Sat May 2 12:31:44 2015
@@ -129,7 +129,7 @@ public class Base64Utils {
}
/**
- *
+ * @deprecated
*/
public static byte[] decode(char[] data, int off, int len) {
char[] ibuf = new char[4];
@@ -181,10 +181,7 @@ public class Base64Utils {
}
/**
- * checks input string for invalid Base64 characters
- *
- * @param data
- * @return true, if String contains only valid Base64 characters. false, otherwise
+ * @deprecated
*/
public static boolean isValidBase64Encoding(String data) {
for (int i = 0; i < data.length(); i++) {
@@ -204,7 +201,7 @@ public class Base64Utils {
/**
- *
+ * @deprecated
*/
public static void decode(char[] data, int off, int len,
OutputStream ostream) throws IOException {
@@ -226,7 +223,7 @@ public class Base64Utils {
}
/**
- *
+ * @deprecated
*/
public static void decode(String data, OutputStream ostream)
throws IOException {
@@ -247,12 +244,16 @@ public class Base64Utils {
}
}
- /** Returns base64 representation of specified byte array. */
+ /**
+ * @deprecated
+ */
public static String encode(byte[] data) {
return encode(data, 0, data.length);
}
- /** Returns base64 representation of specified byte array. */
+ /**
+ * @deprecated
+ */
public static String encode(byte[] data, int off, int len) {
if (len <= 0)
return "";
@@ -287,7 +288,9 @@ public class Base64Utils {
return new String(out, 0, windex);
}
- /** Outputs base64 representation of the specified byte array to the specified String Buffer */
+ /**
+ * @deprecated
+ */
public static void encode(byte[] data, int off, int len, StringBuffer buffer) {
if (len <= 0) {
return;
@@ -325,7 +328,9 @@ public class Base64Utils {
}
}
- /** Outputs base64 representation of the specified byte array to a byte stream. */
+ /**
+ * @deprecated
+ */
public static void encode(byte[] data, int off, int len,
OutputStream ostream) throws IOException {
if (len <= 0)
@@ -362,7 +367,9 @@ public class Base64Utils {
}
}
- /** Outputs base64 representation of the specified byte array to a character stream. */
+ /**
+ * @deprecated
+ */
public static void encode(byte[] data, int off, int len, Writer writer)
throws IOException {
if (len <= 0)
Modified: webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/base64/Base64UtilsTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/base64/Base64UtilsTest.java?rev=1677312&r1=1677311&r2=1677312&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/base64/Base64UtilsTest.java (original)
+++ webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/util/base64/Base64UtilsTest.java Sat May 2 12:31:44 2015
@@ -24,6 +24,8 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import org.apache.commons.codec.binary.Base64;
+
import junit.framework.TestCase;
public class Base64UtilsTest extends TestCase {
@@ -32,18 +34,14 @@ public class Base64UtilsTest extends Tes
ByteArrayInputStream byteStream;
- /*
- * Class under test for String encode(byte[])
- */
-
- public void testEncodebyteArray() throws Exception {
+ public void testDecode() throws Exception {
Object actualObject;
String expectedBase64;
expectedObject = new String("Lanka Software Foundation");
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutStream = new ObjectOutputStream(byteStream);
objectOutStream.writeObject(expectedObject);
- expectedBase64 = Base64Utils.encode(byteStream.toByteArray());
+ expectedBase64 = Base64.encodeBase64String(byteStream.toByteArray());
byte[] tempa = Base64Utils.decode(expectedBase64);
ObjectInputStream objectInStream = new ObjectInputStream(
new ByteArrayInputStream(tempa));