Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 33261 invoked from network); 25 Jul 2007 03:34:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jul 2007 03:34:54 -0000 Received: (qmail 22170 invoked by uid 500); 25 Jul 2007 03:34:55 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 22153 invoked by uid 500); 25 Jul 2007 03:34:55 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 22144 invoked by uid 99); 25 Jul 2007 03:34:55 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jul 2007 20:34:55 -0700 X-ASF-Spam-Status: No, hits=-99.5 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; Tue, 24 Jul 2007 20:34:53 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5FBA11A981A; Tue, 24 Jul 2007 20:34:33 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r559302 - /harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java Date: Wed, 25 Jul 2007 03:34:33 -0000 To: commits@harmony.apache.org From: pyang@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070725033433.5FBA11A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pyang Date: Tue Jul 24 20:34:32 2007 New Revision: 559302 URL: http://svn.apache.org/viewvc?view=rev&rev=559302 Log: Apply patch for HARMONY-4521([classlib][nio][java6]Add new interfaces in java.nio.Buffer.java) Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java?view=diff&rev=559302&r1=559301&r2=559302 ============================================================================== --- harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java (original) +++ harmony/enhanced/classlib/branches/java6/modules/nio/src/main/java/java/nio/Buffer.java Tue Jul 24 20:34:32 2007 @@ -92,6 +92,52 @@ } this.capacity = this.limit = capacity; } + + /** + * Answers the array that backs this buffer. + * + * It wants to allow array-backed buffers to be passed to native code more + * efficiently. Subclasses provide more concrete return values for this + * method. + * + * Modifications to this buffer's content will cause the returned array's + * content to be modified, and vice versa. + * + * Invoking the hasArray method before invoking this method + * can guarantee it to be called safely. + * + * @return The array that backs this buffer + * + * @throws ReadOnlyBufferException - + * If this buffer is backed by an array but is read-only + * UnsupportedOperationException - If this buffer is not backed + * by an accessible array + * @since 1.6 + * + */ + public abstract Object array(); + + /** + * Returns the offset within this buffer's backing array of the first + * element of the buffer (optional operation). + * + * If this buffer is backed by an array then buffer position p corresponds + * to array index p + arrayOffset(). + * + * Invoke the hasArray method before invoking this method in order to ensure + * that this buffer has an accessible backing array. + * + * @return The offset within this buffer's array of the first element of the + * buffer + * + * @throws ReadOnlyBufferException - + * If this buffer is backed by an array but is read-only + * UnsupportedOperationException - If this buffer is not backed + * by an accessible array + * + * @since 1.6 + */ + public abstract int arrayOffset(); /** * Returns the capacity of this buffer. @@ -137,6 +183,19 @@ mark = UNSET_MARK; return this; } + + /** + * Answers if this buffer is backed by an available array. + * + * If it returns true then the array and + * arrayOffset methods can be called safely. + * + * @return true if and only if this buffer is backed by an array and is + * not read-only. + * + * @since 1.6 + */ + public abstract boolean hasArray(); /** * Returns true if there are remaining element(s) in this buffer. @@ -149,6 +208,15 @@ public final boolean hasRemaining() { return position < limit; } + + /** + * Answers if this buffer is direct. + * + * @return true if and only if this buffer is direct + * + * @since 1.6 + */ + public abstract boolean isDirect(); /** * Returns whether this buffer is readonly or not.