Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1BABC9DA6 for ; Fri, 4 May 2012 02:09:00 +0000 (UTC) Received: (qmail 79287 invoked by uid 500); 4 May 2012 02:08:59 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 79223 invoked by uid 500); 4 May 2012 02:08:59 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 79216 invoked by uid 99); 4 May 2012 02:08:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 02:08:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 May 2012 02:08:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D3C59238896F for ; Fri, 4 May 2012 02:08:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1333741 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java Date: Fri, 04 May 2012 02:08:33 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120504020833.D3C59238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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