You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/05/04 04:08:33 UTC

svn commit: r1333741 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java

Author: sebb
Date: Fri May  4 02:08:33 2012
New Revision: 1333741

URL: http://svn.apache.org/viewvc?rev=1333741&view=rev
Log:
Put identical methods together

Modified:
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java?rev=1333741&r1=1333740&r2=1333741&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java Fri May  4 02:08:33 2012
@@ -293,6 +293,7 @@ public abstract class BaseNCodec impleme
 
     /**
      * Encodes a byte[] containing binary data, into a String containing characters in the Base-N alphabet.
+     * Uses UTF8 encoding.
      *
      * @param pArray
      *            a byte array containing binary data
@@ -303,6 +304,17 @@ public abstract class BaseNCodec impleme
     }
 
     /**
+     * Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet.
+     * Uses UTF8 encoding.
+     *
+     * @param pArray a byte array containing binary data
+     * @return String containing only character data in the appropriate alphabet.
+    */
+    public String encodeAsString(byte[] pArray){
+        return StringUtils.newStringUtf8(encode(pArray));
+    }
+
+    /**
      * Decodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of the
      * Decoder interface, and will throw a DecoderException if the supplied object is not of type byte[] or String.
      *
@@ -374,17 +386,6 @@ public abstract class BaseNCodec impleme
         return buf;
     }
     
-    /**
-     * Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet.
-     * Uses UTF8 encoding.
-     *
-     * @param pArray a byte array containing binary data
-     * @return String containing only character data in the appropriate alphabet.
-    */
-    public String encodeAsString(byte[] pArray){
-        return StringUtils.newStringUtf8(encode(pArray));
-    }
-
     abstract void encode(byte[] pArray, int i, int length, Context context);  // package protected for access from I/O streams
 
     abstract void decode(byte[] pArray, int i, int length, Context context); // package protected for access from I/O streams