In JDK6, there are 4 abstract methods added to java.nio.Buffer. This patch adds these. This has no impact on any of the subclasses because they already implemented all of these 4 methods.
2007-04-12 Roman Kennke <[EMAIL PROTECTED]> * java/nio/Buffer.java (array): New abstract method. (hasArray): New abstract method. (arrayOffset): New abstract method. (isDirect): New abstract method. /Roman -- aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-0 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt
Index: java/nio/Buffer.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/Buffer.java,v retrieving revision 1.16 diff -u -1 -5 -r1.16 Buffer.java --- java/nio/Buffer.java 3 Aug 2005 13:12:59 -0000 1.16 +++ java/nio/Buffer.java 12 Apr 2007 21:12:52 -0000 @@ -346,16 +346,77 @@ * @param offset The offset within the array of the first byte to be read; * must be non-negative and no larger than arraylength. * @param length The number of bytes to be read from the given array; * must be non-negative and no larger than arraylength - offset. * * @exception IndexOutOfBoundsException If the preconditions on the offset * and length parameters do not hold */ static final void checkArraySize(int arraylength, int offset, int length) { if ((offset < 0) || (length < 0) || (arraylength < length + offset)) throw new IndexOutOfBoundsException (); } + + /** + * Returns the backing array of this buffer, if this buffer has one. + * Modification to the array are directly visible in this buffer and vice + * versa. + * + * <p> + * If this is a read-only buffer, then a [EMAIL PROTECTED] ReadOnlyBufferException} is + * thrown because exposing the array would allow to circumvent the read-only + * property. If this buffer doesn't have an array, then an + * [EMAIL PROTECTED] UnsupportedOperationException} is thrown. Applications should check + * if this buffer supports a backing array by calling [EMAIL PROTECTED] #hasArray} + * first.</p> + * + * @return the backing array of this buffer + * + * @throws ReadOnlyBufferException when this buffer is read only + * @throws UnsupportedOperationException when this buffer does not provide + * a backing array + * + * @since 1.6 + */ + public abstract Object array(); + + /** + * Returns <code>true</code> if this buffer can provide a backing array, + * <code>false</code> otherwise. When <code>true</code>, application code + * can call [EMAIL PROTECTED] #array()} to access this backing array. + * + * @return <code>true</code> if this buffer can provide a backing array, + * <code>false</code> otherwise + * + * @since 1.6 + */ + public abstract boolean hasArray(); + + /** + * For buffers that are backed by a Java array, this returns the offset + * into that array at which the buffer content starts. + * + * @return the offset into the backing array at which the buffer content + * starts + * @throws ReadOnlyBufferException when this buffer is read only + * @throws UnsupportedOperationException when this buffer does not provide + * a backing array + * + * @since 1.6 + */ + public abstract int arrayOffset(); + + /** + * Returns <code>true</code> when this buffer is direct, <code>false</code> + * otherwise. A direct buffer is usually backed by a raw memory area instead + * of a Java array. + * + * @return <code>true</code> when this buffer is direct, <code>false</code> + * otherwise + * + * @since 1.6 + */ + public abstract boolean isDirect(); }
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil