Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 37423 invoked from network); 29 Dec 2006 03:21:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Dec 2006 03:21:35 -0000 Received: (qmail 57249 invoked by uid 500); 29 Dec 2006 03:17:04 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 56499 invoked by uid 500); 29 Dec 2006 03:16:58 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 55418 invoked by uid 99); 29 Dec 2006 03:16:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 19:16:53 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 18:17:47 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 5C0AA1A981A; Thu, 28 Dec 2006 18:16:54 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r490908 - /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java Date: Fri, 29 Dec 2006 02:16:54 -0000 To: commits@directory.apache.org From: trustin@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061229021654.5C0AA1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trustin Date: Thu Dec 28 18:16:53 2006 New Revision: 490908 URL: http://svn.apache.org/viewvc?view=rev&rev=490908 Log: Added JavaDoc for mitosis.util.OctetString Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java?view=diff&rev=490908&r1=490907&r2=490908 ============================================================================== --- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java (original) +++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java Thu Dec 28 18:16:53 2006 @@ -21,9 +21,10 @@ /** - * A utuility class that generates octet strings from numbers. + * A utuility class that converts an integer to an octet string, and vice + * versa. * - * @author Trustin Lee (trustin@apache.org) + * @author The Apache Directory Project (dev@directory.apache.org) * @version $Rev: 118 $, $Date: 2006-09-18 13:48:47Z $ */ public class OctetString @@ -51,64 +52,74 @@ } - public static void append( StringBuffer dst, long value ) + /** + * Converts the specified value to an octet string and appends + * it to the specified destination. + */ + public static void append( StringBuffer destination, long value ) { int v; v = ( int ) ( value >>> 56 ); - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 48 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 40 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 32 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 24 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 16 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) ( value >>> 8 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( int ) value & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); } - public static void append( StringBuffer dst, int value ) + /** + * Converts the specified value to an octet string and appends + * it to the specified destination. + */ + public static void append( StringBuffer destination, int value ) { int v; v = ( value >>> 24 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( value >>> 16 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = ( value >>> 8 ) & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); v = value & 0xff; - dst.append( highDigits[v] ); - dst.append( lowDigits[v] ); + destination.append( highDigits[v] ); + destination.append( lowDigits[v] ); } - + /** + * Converts the specified binary data into an octet string and returns it. + */ public static String toString( byte[] src ) { final int end = src.length; @@ -122,7 +133,9 @@ return dst.toString(); } - + /** + * Converts the specified value into an octet string and returns it. + */ public static String toString( long value ) { StringBuffer dst = new StringBuffer( 16 ); @@ -130,7 +143,9 @@ return dst.toString(); } - + /** + * Converts the specified value into an octet string and returns it. + */ public static String toString( int value ) { StringBuffer dst = new StringBuffer( 8 ); @@ -138,13 +153,19 @@ return dst.toString(); } - + /** + * Converts the specified octet string value into an integer and returns + * it. + */ public static int parseInt( String value ) { return Integer.parseInt( value, 16 ); } - + /** + * Converts the specified octet string value into a long integer and + * returns it. + */ public static long parseLong( String value ) { return Long.parseLong( value, 16 );