harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r578091 [6/8] - /harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/
Date Fri, 21 Sep 2007 13:06:01 GMT
Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongBuffer.java Fri Sep 21 06:05:59 2007
@@ -31,538 +31,542 @@
  * </ul>
  * </p>
  */
-public abstract class LongBuffer extends Buffer implements Comparable<LongBuffer> {
+public abstract class LongBuffer extends Buffer implements
+        Comparable<LongBuffer> {
 
-	/**
-	 * Creates a long buffer based on a new allocated long array.
-	 * 
-	 * @param capacity
-	 *            The capacity of the new buffer
-	 * @return The created long buffer
-	 * @throws IllegalArgumentException
-	 *             If <code>capacity</code> is less than zero
-	 */
-	public static LongBuffer allocate(int capacity) {
-		if (capacity < 0) {
-			throw new IllegalArgumentException();
-		}
-		return BufferFactory.newLongBuffer(capacity);
-	}
-
-	/**
-	 * Creates a new long buffer by wrapping the given long array.
-	 * <p>
-	 * Calling this method has the same effect as
-	 * <code>wrap(array, 0, array.length)</code>.
-	 * </p>
-	 * 
-	 * @param array
-	 *            The long array which the new buffer will be based on
-	 * @return The created long buffer
-	 */
-	public static LongBuffer wrap(long[] array) {
-		return wrap(array, 0, array.length);
-	}
-
-	/**
-	 * Creates new a long buffer by wrapping the given long array.
-	 * <p>
-	 * The new buffer's position will be <code>start</code>, limit will be
-	 * <code>start + len</code>, capacity will be the length of the array.
-	 * </p>
-	 * 
-	 * @param array
-	 *            The long array which the new buffer will be based on
-	 * @param start
-	 *            The start index, must be no less than zero and no greater than
-	 *            <code>array.length</code>
-	 * @param len
-	 *            The length, must be no less than zero and no greater than
-	 *            <code>array.length - start</code>
-	 * @return The created long buffer
-	 * @exception IndexOutOfBoundsException
-	 *                If either <code>start</code> or <code>len</code> is
-	 *                invalid
-	 */
-	public static LongBuffer wrap(long[] array, int start, int len) {
-                if (array == null) {
-                        throw new NullPointerException();
-                }
-                if (start < 0 || len < 0 || (long)len + (long)start > array.length) {
-                        throw new IndexOutOfBoundsException();
-                }
-
-		LongBuffer buf = BufferFactory.newLongBuffer(array);
-		buf.position = start;
-		buf.limit = start + len;
-
-		return buf;
-	}
-
-	/**
-	 * Constructs a <code>LongBuffer</code> with given capacity.
-	 * 
-	 * @param capacity
-	 *            The capacity of the buffer
-	 */
-	LongBuffer(int capacity) {
-		super(capacity);
-	}
-
-	/**
-	 * Returns the long array which this buffer is based on, if there's one.
-	 * 
-	 * @return The long array which this buffer is based on
-	 * @exception ReadOnlyBufferException
-	 *                If this buffer is based on an array, but it is readonly
-	 * @exception UnsupportedOperationException
-	 *                If this buffer is not based on an array
-	 */
-	public final long[] array() {
-		return protectedArray();
-	}
-
-	/**
-	 * Returns the offset of the long array which this buffer is based on, if
-	 * there's one.
-	 * <p>
-	 * The offset is the index of the array corresponds to the zero position of
-	 * the buffer.
-	 * </p>
-	 * 
-	 * @return The offset of the long array which this buffer is based on
-	 * @exception ReadOnlyBufferException
-	 *                If this buffer is based on an array, but it is readonly
-	 * @exception UnsupportedOperationException
-	 *                If this buffer is not based on an array
-	 */
-	public final int arrayOffset() {
-		return protectedArrayOffset();
-	}
-
-	/**
-	 * Returns a readonly buffer that shares content with this buffer.
-	 * <p>
-	 * The returned buffer is guaranteed to be a new instance, even this buffer
-	 * is readonly itself. The new buffer's position, limit, capacity and mark
-	 * are the same as this buffer.
-	 * </p>
-	 * <p>
-	 * The new buffer shares content with this buffer, which means this buffer's
-	 * change of content will be visible to the new buffer. The two buffer's
-	 * position, limit and mark are independent.
-	 * </p>
-	 * 
-	 * @return A readonly version of this buffer.
-	 */
-	public abstract LongBuffer asReadOnlyBuffer();
-
-	/**
-	 * Compacts this long buffer.
-	 * <p>
-	 * The remaining <code>long</code>s will be moved to the head of the
-	 * buffer, staring from position zero. Then the position is set to
-	 * <code>remaining()</code>; the limit is set to capacity; the mark is
-	 * cleared.
-	 * </p>
-	 * 
-	 * @return This buffer
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public abstract LongBuffer compact();
-
-	/**
-	 * Compare the remaining <code>long</code>s of this buffer to another
-	 * long buffer's remaining <code>long</code>s.
-	 * 
-	 * @param otherBuffer
-	 *            Another long buffer
-	 * @return a negative value if this is less than <code>other</code>; 0 if
-	 *         this equals to <code>other</code>; a positive value if this is
-	 *         greater than <code>other</code>
-	 * @exception ClassCastException
-	 *                If <code>other</code> is not a long buffer
-	 */
-	public int compareTo(LongBuffer otherBuffer) {
-		int compareRemaining = (remaining() < otherBuffer.remaining()) ? remaining()
-				: otherBuffer.remaining();
-		int thisPos = position;
-		int otherPos = otherBuffer.position;
-		long thisByte, otherByte;
-		while (compareRemaining > 0) {
-			thisByte = get(thisPos);
-			otherByte = otherBuffer.get(otherPos);
-			if (thisByte != otherByte) {
-				return thisByte < otherByte ? -1 : 1;
-			}
-			thisPos++;
-			otherPos++;
-			compareRemaining--;
-		}
-		return remaining() - otherBuffer.remaining();
-	}
-
-	/**
-	 * Returns a duplicated buffer that shares content with this buffer.
-	 * <p>
-	 * The duplicated buffer's position, limit, capacity and mark are the same
-	 * as this buffer. The duplicated buffer's readonly property and byte order
-	 * are same as this buffer too.
-	 * </p>
-	 * <p>
-	 * The new buffer shares content with this buffer, which means either
-	 * buffer's change of content will be visible to the other. The two buffer's
-	 * position, limit and mark are independent.
-	 * </p>
-	 * 
-	 * @return A duplicated buffer that shares content with this buffer.
-	 */
-	public abstract LongBuffer duplicate();
-
-	/**
-	 * Tests whether this long buffer equals to another object.
-	 * <p>
-	 * If <code>other</code> is not a long buffer, then false is returned.
-	 * </p>
-	 * <p>
-	 * Two long buffers are equals if, and only if, their remaining
-	 * <code>long</code>s are exactly the same. Position, limit, capacity and
-	 * mark are not considered.
-	 * </p>
-	 * 
-	 * @param other
-	 *            the object to be compared against
-	 * @return Whether this long buffer equals to another object.
-	 */
-	public boolean equals(Object other) {
-		if (!(other instanceof LongBuffer)) {
-			return false;
-		}
-		LongBuffer otherBuffer = (LongBuffer) other;
-
-		if (remaining() != otherBuffer.remaining()) {
-			return false;
-		}
-
-		int myPosition = position;
-		int otherPosition = otherBuffer.position;
-		boolean equalSoFar = true;
-		while (equalSoFar && (myPosition < limit)) {
-			equalSoFar = get(myPosition++) == otherBuffer.get(otherPosition++);
-		}
-
-		return equalSoFar;
-	}
-
-	/**
-	 * Returns the long at the current position and increase the position by 1.
-	 * 
-	 * @return The long at the current position.
-	 * @exception BufferUnderflowException
-	 *                If the position is equal or greater than limit
-	 */
-	public abstract long get();
-
-	/**
-	 * Reads <code>long</code>s from the current position into the specified
-	 * long array and increase the position by the number of <code>long</code>s
-	 * read.
-	 * <p>
-	 * Calling this method has the same effect as
-	 * <code>get(dest, 0, dest.length)</code>.
-	 * </p>
-	 * 
-	 * @param dest
-	 *            The destination long array
-	 * @return This buffer
-	 * @exception BufferUnderflowException
-	 *                if <code>dest.length</code> is greater than
-	 *                <code>remaining()</code>
-	 */
-	public LongBuffer get(long[] dest) {
-		return get(dest, 0, dest.length);
-	}
-
-	/**
-	 * Reads <code>long</code>s from the current position into the specified
-	 * long array, starting from the specified offset, and increase the position
-	 * by the number of <code>long</code>s read.
-	 * 
-	 * @param dest
-	 *            The target long array
-	 * @param off
-	 *            The offset of the long array, must be no less than zero and no
-	 *            greater than <code>dest.length</code>
-	 * @param len
-	 *            The number of <code>long</code>s to read, must be no less
-	 *            than zero and no greater than <code>dest.length - off</code>
-	 * @return This buffer
-	 * @exception IndexOutOfBoundsException
-	 *                If either <code>off</code> or <code>len</code> is
-	 *                invalid
-	 * @exception BufferUnderflowException
-	 *                If <code>len</code> is greater than
-	 *                <code>remaining()</code>
-	 */
-	public LongBuffer get(long[] dest, int off, int len) {
+    /**
+     * Creates a long buffer based on a new allocated long array.
+     * 
+     * @param capacity
+     *            The capacity of the new buffer
+     * @return The created long buffer
+     * @throws IllegalArgumentException
+     *             If <code>capacity</code> is less than zero
+     */
+    public static LongBuffer allocate(int capacity) {
+        if (capacity < 0) {
+            throw new IllegalArgumentException();
+        }
+        return BufferFactory.newLongBuffer(capacity);
+    }
+
+    /**
+     * Creates a new long buffer by wrapping the given long array.
+     * <p>
+     * Calling this method has the same effect as
+     * <code>wrap(array, 0, array.length)</code>.
+     * </p>
+     * 
+     * @param array
+     *            The long array which the new buffer will be based on
+     * @return The created long buffer
+     */
+    public static LongBuffer wrap(long[] array) {
+        return wrap(array, 0, array.length);
+    }
+
+    /**
+     * Creates new a long buffer by wrapping the given long array.
+     * <p>
+     * The new buffer's position will be <code>start</code>, limit will be
+     * <code>start + len</code>, capacity will be the length of the array.
+     * </p>
+     * 
+     * @param array
+     *            The long array which the new buffer will be based on
+     * @param start
+     *            The start index, must be no less than zero and no greater than
+     *            <code>array.length</code>
+     * @param len
+     *            The length, must be no less than zero and no greater than
+     *            <code>array.length - start</code>
+     * @return The created long buffer
+     * @exception IndexOutOfBoundsException
+     *                If either <code>start</code> or <code>len</code> is
+     *                invalid
+     */
+    public static LongBuffer wrap(long[] array, int start, int len) {
+        if (array == null) {
+            throw new NullPointerException();
+        }
+        if (start < 0 || len < 0 || (long) len + (long) start > array.length) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        LongBuffer buf = BufferFactory.newLongBuffer(array);
+        buf.position = start;
+        buf.limit = start + len;
+
+        return buf;
+    }
+
+    /**
+     * Constructs a <code>LongBuffer</code> with given capacity.
+     * 
+     * @param capacity
+     *            The capacity of the buffer
+     */
+    LongBuffer(int capacity) {
+        super(capacity);
+    }
+
+    /**
+     * Returns the long array which this buffer is based on, if there's one.
+     * 
+     * @return The long array which this buffer is based on
+     * @exception ReadOnlyBufferException
+     *                If this buffer is based on an array, but it is readonly
+     * @exception UnsupportedOperationException
+     *                If this buffer is not based on an array
+     */
+    public final long[] array() {
+        return protectedArray();
+    }
+
+    /**
+     * Returns the offset of the long array which this buffer is based on, if
+     * there's one.
+     * <p>
+     * The offset is the index of the array corresponds to the zero position of
+     * the buffer.
+     * </p>
+     * 
+     * @return The offset of the long array which this buffer is based on
+     * @exception ReadOnlyBufferException
+     *                If this buffer is based on an array, but it is readonly
+     * @exception UnsupportedOperationException
+     *                If this buffer is not based on an array
+     */
+    public final int arrayOffset() {
+        return protectedArrayOffset();
+    }
+
+    /**
+     * Returns a readonly buffer that shares content with this buffer.
+     * <p>
+     * The returned buffer is guaranteed to be a new instance, even this buffer
+     * is readonly itself. The new buffer's position, limit, capacity and mark
+     * are the same as this buffer.
+     * </p>
+     * <p>
+     * The new buffer shares content with this buffer, which means this buffer's
+     * change of content will be visible to the new buffer. The two buffer's
+     * position, limit and mark are independent.
+     * </p>
+     * 
+     * @return A readonly version of this buffer.
+     */
+    public abstract LongBuffer asReadOnlyBuffer();
+
+    /**
+     * Compacts this long buffer.
+     * <p>
+     * The remaining <code>long</code>s will be moved to the head of the
+     * buffer, staring from position zero. Then the position is set to
+     * <code>remaining()</code>; the limit is set to capacity; the mark is
+     * cleared.
+     * </p>
+     * 
+     * @return This buffer
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public abstract LongBuffer compact();
+
+    /**
+     * Compare the remaining <code>long</code>s of this buffer to another
+     * long buffer's remaining <code>long</code>s.
+     * 
+     * @param otherBuffer
+     *            Another long buffer
+     * @return a negative value if this is less than <code>other</code>; 0 if
+     *         this equals to <code>other</code>; a positive value if this is
+     *         greater than <code>other</code>
+     * @exception ClassCastException
+     *                If <code>other</code> is not a long buffer
+     */
+    public int compareTo(LongBuffer otherBuffer) {
+        int compareRemaining = (remaining() < otherBuffer.remaining()) ? remaining()
+                : otherBuffer.remaining();
+        int thisPos = position;
+        int otherPos = otherBuffer.position;
+        long thisByte, otherByte;
+        while (compareRemaining > 0) {
+            thisByte = get(thisPos);
+            otherByte = otherBuffer.get(otherPos);
+            if (thisByte != otherByte) {
+                return thisByte < otherByte ? -1 : 1;
+            }
+            thisPos++;
+            otherPos++;
+            compareRemaining--;
+        }
+        return remaining() - otherBuffer.remaining();
+    }
+
+    /**
+     * Returns a duplicated buffer that shares content with this buffer.
+     * <p>
+     * The duplicated buffer's position, limit, capacity and mark are the same
+     * as this buffer. The duplicated buffer's readonly property and byte order
+     * are same as this buffer too.
+     * </p>
+     * <p>
+     * The new buffer shares content with this buffer, which means either
+     * buffer's change of content will be visible to the other. The two buffer's
+     * position, limit and mark are independent.
+     * </p>
+     * 
+     * @return A duplicated buffer that shares content with this buffer.
+     */
+    public abstract LongBuffer duplicate();
+
+    /**
+     * Tests whether this long buffer equals to another object.
+     * <p>
+     * If <code>other</code> is not a long buffer, then false is returned.
+     * </p>
+     * <p>
+     * Two long buffers are equals if, and only if, their remaining
+     * <code>long</code>s are exactly the same. Position, limit, capacity and
+     * mark are not considered.
+     * </p>
+     * 
+     * @param other
+     *            the object to be compared against
+     * @return Whether this long buffer equals to another object.
+     */
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof LongBuffer)) {
+            return false;
+        }
+        LongBuffer otherBuffer = (LongBuffer) other;
+
+        if (remaining() != otherBuffer.remaining()) {
+            return false;
+        }
+
+        int myPosition = position;
+        int otherPosition = otherBuffer.position;
+        boolean equalSoFar = true;
+        while (equalSoFar && (myPosition < limit)) {
+            equalSoFar = get(myPosition++) == otherBuffer.get(otherPosition++);
+        }
+
+        return equalSoFar;
+    }
+
+    /**
+     * Returns the long at the current position and increase the position by 1.
+     * 
+     * @return The long at the current position.
+     * @exception BufferUnderflowException
+     *                If the position is equal or greater than limit
+     */
+    public abstract long get();
+
+    /**
+     * Reads <code>long</code>s from the current position into the specified
+     * long array and increase the position by the number of <code>long</code>s
+     * read.
+     * <p>
+     * Calling this method has the same effect as
+     * <code>get(dest, 0, dest.length)</code>.
+     * </p>
+     * 
+     * @param dest
+     *            The destination long array
+     * @return This buffer
+     * @exception BufferUnderflowException
+     *                if <code>dest.length</code> is greater than
+     *                <code>remaining()</code>
+     */
+    public LongBuffer get(long[] dest) {
+        return get(dest, 0, dest.length);
+    }
+
+    /**
+     * Reads <code>long</code>s from the current position into the specified
+     * long array, starting from the specified offset, and increase the position
+     * by the number of <code>long</code>s read.
+     * 
+     * @param dest
+     *            The target long array
+     * @param off
+     *            The offset of the long array, must be no less than zero and no
+     *            greater than <code>dest.length</code>
+     * @param len
+     *            The number of <code>long</code>s to read, must be no less
+     *            than zero and no greater than <code>dest.length - off</code>
+     * @return This buffer
+     * @exception IndexOutOfBoundsException
+     *                If either <code>off</code> or <code>len</code> is
+     *                invalid
+     * @exception BufferUnderflowException
+     *                If <code>len</code> is greater than
+     *                <code>remaining()</code>
+     */
+    public LongBuffer get(long[] dest, int off, int len) {
         int length = dest.length;
-        if (off < 0 || len < 0 || (long)len + (long)off > length) {
+        if (off < 0 || len < 0 || (long) len + (long) off > length) {
             throw new IndexOutOfBoundsException();
         }
-        
-		if (len > remaining()) {
-			throw new BufferUnderflowException();
-		}
-		for (int i = off; i < off + len; i++) {
-			dest[i] = get();
-		}
-		return this;
-	}
-
-	/**
-	 * Returns a long at the specified index, and the position is not changed.
-	 * 
-	 * @param index
-	 *            The index, must be no less than zero and less than limit
-	 * @return A long at the specified index.
-	 * @exception IndexOutOfBoundsException
-	 *                If index is invalid
-	 */
-	public abstract long get(int index);
-
-	/**
-	 * Returns whether this buffer is based on a long array and is read/write.
-	 * <p>
-	 * If this buffer is readonly, then false is returned.
-	 * </p>
-	 * 
-	 * @return Whether this buffer is based on a long array and is read/write.
-	 */
-	public final boolean hasArray() {
-		return protectedHasArray();
-	}
-
-	/**
-	 * Hash code is calculated from the remaining <code>long</code>s.
-	 * <p>
-	 * Position, limit, capacity and mark don't affect the hash code.
-	 * </p>
-	 * 
-	 * @return The hash code calculated from the remaining <code>long</code>s.
-	 */
-	public int hashCode() {
-		int myPosition = position;
-		int hash = 0;
-		long l;
-		while (myPosition < limit) {
-			l = get(myPosition++);
-			hash = hash + ((int) l) ^ ((int) (l >> 32));
-		}
-		return hash;
-	}
-
-	/**
-	 * Returns true if this buffer is direct.
-	 * <p>
-	 * A direct buffer will try its best to take advantage of native memory APIs
-	 * and it may not stay in java heap, thus not affected by GC.
-	 * </p>
-	 * <p>
-	 * A long buffer is direct, if it is based on a byte buffer and the byte
-	 * buffer is direct.
-	 * </p>
-	 * 
-	 * @return True if this buffer is direct.
-	 */
-	public abstract boolean isDirect();
-
-	/**
-	 * Returns the byte order used by this buffer when converting
-	 * <code>long</code>s from/to <code>byte</code>s.
-	 * <p>
-	 * If this buffer is not based on a byte buffer, then always return the
-	 * platform's native byte order.
-	 * </p>
-	 * 
-	 * @return The byte order used by this buffer when converting
-	 *         <code>long</code>s from/to <code>byte</code>s.
-	 */
-	public abstract ByteOrder order();
-
-	/**
-	 * Child class implements this method to realize <code>array()</code>.
-	 * 
-	 * @return see <code>array()</code>
-	 */
-	abstract long[] protectedArray();
-
-	/**
-	 * Child class implements this method to realize <code>arrayOffset()</code>.
-	 * 
-	 * @return see <code>arrayOffset()</code>
-	 */
-	abstract int protectedArrayOffset();
-
-	/**
-	 * Child class implements this method to realize <code>hasArray()</code>.
-	 * 
-	 * @return see <code>hasArray()</code>
-	 */
-	abstract boolean protectedHasArray();
-
-	/**
-	 * Writes the given long to the current position and increase the position
-	 * by 1.
-	 * 
-	 * @param l
-	 *            The long to write
-	 * @return This buffer
-	 * @exception BufferOverflowException
-	 *                If position is equal or greater than limit
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public abstract LongBuffer put(long l);
-
-	/**
-	 * Writes <code>long</code>s in the given long array to the current
-	 * position and increase the position by the number of <code>long</code>s
-	 * written.
-	 * <p>
-	 * Calling this method has the same effect as
-	 * <code>put(src, 0, src.length)</code>.
-	 * </p>
-	 * 
-	 * @param src
-	 *            The source long array
-	 * @return This buffer
-	 * @exception BufferOverflowException
-	 *                If <code>remaining()</code> is less than
-	 *                <code>src.length</code>
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public final LongBuffer put(long[] src) {
-		return put(src, 0, src.length);
-	}
-
-	/**
-	 * Writes <code>long</code>s in the given long array, starting from the
-	 * specified offset, to the current position and increase the position by
-	 * the number of <code>long</code>s written.
-	 * 
-	 * @param src
-	 *            The source long array
-	 * @param off
-	 *            The offset of long array, must be no less than zero and no
-	 *            greater than <code>src.length</code>
-	 * @param len
-	 *            The number of <code>long</code>s to write, must be no less
-	 *            than zero and no greater than <code>src.length - off</code>
-	 * @return This buffer
-	 * @exception BufferOverflowException
-	 *                If <code>remaining()</code> is less than
-	 *                <code>len</code>
-	 * @exception IndexOutOfBoundsException
-	 *                If either <code>off</code> or <code>len</code> is
-	 *                invalid
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public LongBuffer put(long[] src, int off, int len) {
+
+        if (len > remaining()) {
+            throw new BufferUnderflowException();
+        }
+        for (int i = off; i < off + len; i++) {
+            dest[i] = get();
+        }
+        return this;
+    }
+
+    /**
+     * Returns a long at the specified index, and the position is not changed.
+     * 
+     * @param index
+     *            The index, must be no less than zero and less than limit
+     * @return A long at the specified index.
+     * @exception IndexOutOfBoundsException
+     *                If index is invalid
+     */
+    public abstract long get(int index);
+
+    /**
+     * Returns whether this buffer is based on a long array and is read/write.
+     * <p>
+     * If this buffer is readonly, then false is returned.
+     * </p>
+     * 
+     * @return Whether this buffer is based on a long array and is read/write.
+     */
+    public final boolean hasArray() {
+        return protectedHasArray();
+    }
+
+    /**
+     * Hash code is calculated from the remaining <code>long</code>s.
+     * <p>
+     * Position, limit, capacity and mark don't affect the hash code.
+     * </p>
+     * 
+     * @return The hash code calculated from the remaining <code>long</code>s.
+     */
+    @Override
+    public int hashCode() {
+        int myPosition = position;
+        int hash = 0;
+        long l;
+        while (myPosition < limit) {
+            l = get(myPosition++);
+            hash = hash + ((int) l) ^ ((int) (l >> 32));
+        }
+        return hash;
+    }
+
+    /**
+     * Returns true if this buffer is direct.
+     * <p>
+     * A direct buffer will try its best to take advantage of native memory APIs
+     * and it may not stay in java heap, thus not affected by GC.
+     * </p>
+     * <p>
+     * A long buffer is direct, if it is based on a byte buffer and the byte
+     * buffer is direct.
+     * </p>
+     * 
+     * @return True if this buffer is direct.
+     */
+    public abstract boolean isDirect();
+
+    /**
+     * Returns the byte order used by this buffer when converting
+     * <code>long</code>s from/to <code>byte</code>s.
+     * <p>
+     * If this buffer is not based on a byte buffer, then always return the
+     * platform's native byte order.
+     * </p>
+     * 
+     * @return The byte order used by this buffer when converting
+     *         <code>long</code>s from/to <code>byte</code>s.
+     */
+    public abstract ByteOrder order();
+
+    /**
+     * Child class implements this method to realize <code>array()</code>.
+     * 
+     * @return see <code>array()</code>
+     */
+    abstract long[] protectedArray();
+
+    /**
+     * Child class implements this method to realize <code>arrayOffset()</code>.
+     * 
+     * @return see <code>arrayOffset()</code>
+     */
+    abstract int protectedArrayOffset();
+
+    /**
+     * Child class implements this method to realize <code>hasArray()</code>.
+     * 
+     * @return see <code>hasArray()</code>
+     */
+    abstract boolean protectedHasArray();
+
+    /**
+     * Writes the given long to the current position and increase the position
+     * by 1.
+     * 
+     * @param l
+     *            The long to write
+     * @return This buffer
+     * @exception BufferOverflowException
+     *                If position is equal or greater than limit
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public abstract LongBuffer put(long l);
+
+    /**
+     * Writes <code>long</code>s in the given long array to the current
+     * position and increase the position by the number of <code>long</code>s
+     * written.
+     * <p>
+     * Calling this method has the same effect as
+     * <code>put(src, 0, src.length)</code>.
+     * </p>
+     * 
+     * @param src
+     *            The source long array
+     * @return This buffer
+     * @exception BufferOverflowException
+     *                If <code>remaining()</code> is less than
+     *                <code>src.length</code>
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public final LongBuffer put(long[] src) {
+        return put(src, 0, src.length);
+    }
+
+    /**
+     * Writes <code>long</code>s in the given long array, starting from the
+     * specified offset, to the current position and increase the position by
+     * the number of <code>long</code>s written.
+     * 
+     * @param src
+     *            The source long array
+     * @param off
+     *            The offset of long array, must be no less than zero and no
+     *            greater than <code>src.length</code>
+     * @param len
+     *            The number of <code>long</code>s to write, must be no less
+     *            than zero and no greater than <code>src.length - off</code>
+     * @return This buffer
+     * @exception BufferOverflowException
+     *                If <code>remaining()</code> is less than
+     *                <code>len</code>
+     * @exception IndexOutOfBoundsException
+     *                If either <code>off</code> or <code>len</code> is
+     *                invalid
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public LongBuffer put(long[] src, int off, int len) {
         int length = src.length;
-        if (off < 0 || len < 0 || (long)len + (long)off > length) {
+        if (off < 0 || len < 0 || (long) len + (long) off > length) {
             throw new IndexOutOfBoundsException();
         }
-        
-		if (len > remaining()) {
-			throw new BufferOverflowException();
-		}
-		for (int i = off; i < off + len; i++) {
-			put(src[i]);
-		}
-		return this;
-	}
-
-	/**
-	 * Writes all the remaining <code>long</code>s of the <code>src</code>
-	 * long buffer to this buffer's current position, and increase both buffers'
-	 * position by the number of <code>long</code>s copied.
-	 * 
-	 * @param src
-	 *            The source long buffer
-	 * @return This buffer
-	 * @exception BufferOverflowException
-	 *                If <code>src.remaining()</code> is greater than this
-	 *                buffer's <code>remaining()</code>
-	 * @exception IllegalArgumentException
-	 *                If <code>src</code> is this buffer
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public LongBuffer put(LongBuffer src) {
-		if (src == this) {
-			throw new IllegalArgumentException();
-		}
-		if (src.remaining() > remaining()) {
-			throw new BufferOverflowException();
-		}
+
+        if (len > remaining()) {
+            throw new BufferOverflowException();
+        }
+        for (int i = off; i < off + len; i++) {
+            put(src[i]);
+        }
+        return this;
+    }
+
+    /**
+     * Writes all the remaining <code>long</code>s of the <code>src</code>
+     * long buffer to this buffer's current position, and increase both buffers'
+     * position by the number of <code>long</code>s copied.
+     * 
+     * @param src
+     *            The source long buffer
+     * @return This buffer
+     * @exception BufferOverflowException
+     *                If <code>src.remaining()</code> is greater than this
+     *                buffer's <code>remaining()</code>
+     * @exception IllegalArgumentException
+     *                If <code>src</code> is this buffer
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public LongBuffer put(LongBuffer src) {
+        if (src == this) {
+            throw new IllegalArgumentException();
+        }
+        if (src.remaining() > remaining()) {
+            throw new BufferOverflowException();
+        }
         long[] contents = new long[src.remaining()];
         src.get(contents);
         put(contents);
-		return this;
-	}
+        return this;
+    }
 
-	/**
-	 * Write a long to the specified index of this buffer and the position is
-	 * not changed.
-	 * 
-	 * @param index
-	 *            The index, must be no less than zero and less than the limit
-	 * @param l
-	 *            The long to write
-	 * @return This buffer
-	 * @exception IndexOutOfBoundsException
-	 *                If index is invalid
-	 * @exception ReadOnlyBufferException
-	 *                If no changes may be made to the contents of this buffer
-	 */
-	public abstract LongBuffer put(int index, long l);
-
-	/**
-	 * Returns a sliced buffer that shares content with this buffer.
-	 * <p>
-	 * The sliced buffer's capacity will be this buffer's
-	 * <code>remaining()</code>, and its zero position will correspond to
-	 * this buffer's current position. The new buffer's position will be 0,
-	 * limit will be its capacity, and its mark is unset. The new buffer's
-	 * readonly property and byte order are same as this buffer.
-	 * </p>
-	 * <p>
-	 * The new buffer shares content with this buffer, which means either
-	 * buffer's change of content will be visible to the other. The two buffer's
-	 * position, limit and mark are independent.
-	 * </p>
-	 * 
-	 * @return A sliced buffer that shares content with this buffer.
-	 */
-	public abstract LongBuffer slice();
-
-	/**
-	 * Returns a string represents the state of this long buffer.
-	 * 
-	 * @return A string represents the state of this long buffer.
-	 */
-	public String toString() {
-		StringBuffer buf = new StringBuffer();
-		buf.append(getClass().getName());
-		buf.append(", status: capacity="); //$NON-NLS-1$
-		buf.append(capacity());
-		buf.append(" position="); //$NON-NLS-1$
-		buf.append(position());
-		buf.append(" limit="); //$NON-NLS-1$
-		buf.append(limit());
-		return buf.toString();
-	}
+    /**
+     * Write a long to the specified index of this buffer and the position is
+     * not changed.
+     * 
+     * @param index
+     *            The index, must be no less than zero and less than the limit
+     * @param l
+     *            The long to write
+     * @return This buffer
+     * @exception IndexOutOfBoundsException
+     *                If index is invalid
+     * @exception ReadOnlyBufferException
+     *                If no changes may be made to the contents of this buffer
+     */
+    public abstract LongBuffer put(int index, long l);
+
+    /**
+     * Returns a sliced buffer that shares content with this buffer.
+     * <p>
+     * The sliced buffer's capacity will be this buffer's
+     * <code>remaining()</code>, and its zero position will correspond to
+     * this buffer's current position. The new buffer's position will be 0,
+     * limit will be its capacity, and its mark is unset. The new buffer's
+     * readonly property and byte order are same as this buffer.
+     * </p>
+     * <p>
+     * The new buffer shares content with this buffer, which means either
+     * buffer's change of content will be visible to the other. The two buffer's
+     * position, limit and mark are independent.
+     * </p>
+     * 
+     * @return A sliced buffer that shares content with this buffer.
+     */
+    public abstract LongBuffer slice();
+
+    /**
+     * Returns a string represents the state of this long buffer.
+     * 
+     * @return A string represents the state of this long buffer.
+     */
+    @Override
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append(getClass().getName());
+        buf.append(", status: capacity="); //$NON-NLS-1$
+        buf.append(capacity());
+        buf.append(" position="); //$NON-NLS-1$
+        buf.append(position());
+        buf.append(" limit="); //$NON-NLS-1$
+        buf.append(limit());
+        return buf.toString();
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongToByteBufferAdapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongToByteBufferAdapter.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongToByteBufferAdapter.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/LongToByteBufferAdapter.java Fri Sep 21 06:05:59 2007
@@ -19,7 +19,6 @@
 import org.apache.harmony.nio.internal.DirectBuffer;
 import org.apache.harmony.luni.platform.PlatformAddress;
 
-
 /**
  * This class wraps a byte buffer to be a long buffer.
  * <p>
@@ -35,162 +34,172 @@
  */
 final class LongToByteBufferAdapter extends LongBuffer implements DirectBuffer {
 
-	static LongBuffer wrap(ByteBuffer byteBuffer) {
-		return new LongToByteBufferAdapter(byteBuffer.slice());
-	}
-
-	private final ByteBuffer byteBuffer;
-
-	LongToByteBufferAdapter(ByteBuffer byteBuffer) {
-		super((byteBuffer.capacity() >> 3));
-		this.byteBuffer = byteBuffer;
-		this.byteBuffer.clear();
-	}
-        
-        public int getByteCapacity() {
-            if (byteBuffer instanceof DirectBuffer) {
-                return ((DirectBuffer)byteBuffer).getByteCapacity();
-            } else {
-                assert false : byteBuffer;
-                return -1;
-            }            
-        }
-
-        public PlatformAddress getEffectiveAddress() {
-            if (byteBuffer instanceof DirectBuffer) {
-                return ((DirectBuffer)byteBuffer).getEffectiveAddress();
-            } else {
-                assert false : byteBuffer;
-                return null;
-            }
-        }
-
-        public PlatformAddress getBaseAddress() {
-            if (byteBuffer instanceof DirectBuffer) {
-                return ((DirectBuffer)byteBuffer).getBaseAddress();
-            } else {
-                assert false : byteBuffer;
-                return null;
-            }
-        }
-            
-        public boolean isAddressValid() {
-            if (byteBuffer instanceof DirectBuffer) {
-                return ((DirectBuffer)byteBuffer).isAddressValid();
-            } else {
-                assert false : byteBuffer;
-                return false;
-            }
-        }
-
-        public void addressValidityCheck() {
-            if (byteBuffer instanceof DirectBuffer) {
-                ((DirectBuffer)byteBuffer).addressValidityCheck();
-            } else {
-                assert false : byteBuffer;
-            }
-        }
-            
-        public void free() {
-            if (byteBuffer instanceof DirectBuffer) {
-                ((DirectBuffer)byteBuffer).free();
-            } else {
-                assert false : byteBuffer;
-            }   
-        }
-
-	public LongBuffer asReadOnlyBuffer() {
-		LongToByteBufferAdapter buf = new LongToByteBufferAdapter(byteBuffer
-				.asReadOnlyBuffer());
-		buf.limit = limit;
-		buf.position = position;
-		buf.mark = mark;
-		return buf;
-	}
-
-	public LongBuffer compact() {
-		if (byteBuffer.isReadOnly()) {
-			throw new ReadOnlyBufferException();
-		}
-		byteBuffer.limit(limit << 3);
-		byteBuffer.position(position << 3);
-		byteBuffer.compact();
-		byteBuffer.clear();
-		position = limit - position;
-		limit = capacity;
-		mark = UNSET_MARK;
-		return this;
-	}
-
-	public LongBuffer duplicate() {
-		LongToByteBufferAdapter buf = new LongToByteBufferAdapter(byteBuffer
-				.duplicate());
-		buf.limit = limit;
-		buf.position = position;
-		buf.mark = mark;
-		return buf;
-	}
-
-	public long get() {
-		if (position == limit) {
-			throw new BufferUnderflowException();
-		}
-		return byteBuffer.getLong(position++ << 3);
-	}
-
-	public long get(int index) {
-		if (index < 0 || index >= limit) {
-			throw new IndexOutOfBoundsException();
-		}
-		return byteBuffer.getLong(index << 3);
-	}
-
-	public boolean isDirect() {
-		return byteBuffer.isDirect();
-	}
-
-	public boolean isReadOnly() {
-		return byteBuffer.isReadOnly();
-	}
-
-	public ByteOrder order() {
-		return byteBuffer.order();
-	}
-
-	protected long[] protectedArray() {
-		throw new UnsupportedOperationException();
-	}
-
-	protected int protectedArrayOffset() {
-		throw new UnsupportedOperationException();
-	}
-
-	protected boolean protectedHasArray() {
-		return false;
-	}
-
-	public LongBuffer put(long c) {
-		if (position == limit) {
-			throw new BufferOverflowException();
-		}
-		byteBuffer.putLong(position++ << 3, c);
-		return this;
-	}
-
-	public LongBuffer put(int index, long c) {
-		if (index < 0 || index >= limit) {
-			throw new IndexOutOfBoundsException();
-		}
-		byteBuffer.putLong(index << 3, c);
-		return this;
-	}
-
-	public LongBuffer slice() {
-		byteBuffer.limit(limit << 3);
-		byteBuffer.position(position << 3);
-		LongBuffer result = new LongToByteBufferAdapter(byteBuffer.slice());
-		byteBuffer.clear();
-		return result;
-	}
+    static LongBuffer wrap(ByteBuffer byteBuffer) {
+        return new LongToByteBufferAdapter(byteBuffer.slice());
+    }
+
+    private final ByteBuffer byteBuffer;
+
+    LongToByteBufferAdapter(ByteBuffer byteBuffer) {
+        super((byteBuffer.capacity() >> 3));
+        this.byteBuffer = byteBuffer;
+        this.byteBuffer.clear();
+    }
+
+    public int getByteCapacity() {
+        if (byteBuffer instanceof DirectBuffer) {
+            return ((DirectBuffer) byteBuffer).getByteCapacity();
+        }
+        assert false : byteBuffer;
+        return -1;
+    }
+
+    public PlatformAddress getEffectiveAddress() {
+        if (byteBuffer instanceof DirectBuffer) {
+            return ((DirectBuffer) byteBuffer).getEffectiveAddress();
+        }
+        assert false : byteBuffer;
+        return null;
+    }
+
+    public PlatformAddress getBaseAddress() {
+        if (byteBuffer instanceof DirectBuffer) {
+            return ((DirectBuffer) byteBuffer).getBaseAddress();
+        }
+        assert false : byteBuffer;
+        return null;
+    }
+
+    public boolean isAddressValid() {
+        if (byteBuffer instanceof DirectBuffer) {
+            return ((DirectBuffer) byteBuffer).isAddressValid();
+        }
+        assert false : byteBuffer;
+        return false;
+    }
+
+    public void addressValidityCheck() {
+        if (byteBuffer instanceof DirectBuffer) {
+            ((DirectBuffer) byteBuffer).addressValidityCheck();
+        } else {
+            assert false : byteBuffer;
+        }
+    }
+
+    public void free() {
+        if (byteBuffer instanceof DirectBuffer) {
+            ((DirectBuffer) byteBuffer).free();
+        } else {
+            assert false : byteBuffer;
+        }
+    }
+
+    @Override
+    public LongBuffer asReadOnlyBuffer() {
+        LongToByteBufferAdapter buf = new LongToByteBufferAdapter(byteBuffer
+                .asReadOnlyBuffer());
+        buf.limit = limit;
+        buf.position = position;
+        buf.mark = mark;
+        return buf;
+    }
+
+    @Override
+    public LongBuffer compact() {
+        if (byteBuffer.isReadOnly()) {
+            throw new ReadOnlyBufferException();
+        }
+        byteBuffer.limit(limit << 3);
+        byteBuffer.position(position << 3);
+        byteBuffer.compact();
+        byteBuffer.clear();
+        position = limit - position;
+        limit = capacity;
+        mark = UNSET_MARK;
+        return this;
+    }
+
+    @Override
+    public LongBuffer duplicate() {
+        LongToByteBufferAdapter buf = new LongToByteBufferAdapter(byteBuffer
+                .duplicate());
+        buf.limit = limit;
+        buf.position = position;
+        buf.mark = mark;
+        return buf;
+    }
+
+    @Override
+    public long get() {
+        if (position == limit) {
+            throw new BufferUnderflowException();
+        }
+        return byteBuffer.getLong(position++ << 3);
+    }
+
+    @Override
+    public long get(int index) {
+        if (index < 0 || index >= limit) {
+            throw new IndexOutOfBoundsException();
+        }
+        return byteBuffer.getLong(index << 3);
+    }
+
+    @Override
+    public boolean isDirect() {
+        return byteBuffer.isDirect();
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return byteBuffer.isReadOnly();
+    }
+
+    @Override
+    public ByteOrder order() {
+        return byteBuffer.order();
+    }
+
+    @Override
+    protected long[] protectedArray() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    protected int protectedArrayOffset() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    protected boolean protectedHasArray() {
+        return false;
+    }
+
+    @Override
+    public LongBuffer put(long c) {
+        if (position == limit) {
+            throw new BufferOverflowException();
+        }
+        byteBuffer.putLong(position++ << 3, c);
+        return this;
+    }
+
+    @Override
+    public LongBuffer put(int index, long c) {
+        if (index < 0 || index >= limit) {
+            throw new IndexOutOfBoundsException();
+        }
+        byteBuffer.putLong(index << 3, c);
+        return this;
+    }
+
+    @Override
+    public LongBuffer slice() {
+        byteBuffer.limit(limit << 3);
+        byteBuffer.position(position << 3);
+        LongBuffer result = new LongToByteBufferAdapter(byteBuffer.slice());
+        byteBuffer.clear();
+        return result;
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBuffer.java Fri Sep 21 06:05:59 2007
@@ -21,7 +21,6 @@
 import org.apache.harmony.luni.platform.PlatformAddress;
 import org.apache.harmony.nio.internal.DirectBuffer;
 
-
 /**
  * <code>MappedByteBuffer</code> is a special kind of direct byte buffer,
  * which maps a region of file to memory.
@@ -58,37 +57,39 @@
         super(capa);
         mapMode = mode;
         switch (mapMode) {
-        case IMemorySystem.MMAP_READ_ONLY:
-            wrapped = new ReadOnlyDirectByteBuffer(addr, capa, offset);
-            break;
-        case IMemorySystem.MMAP_READ_WRITE:
-        case IMemorySystem.MMAP_WRITE_COPY:
-            wrapped = new ReadWriteDirectByteBuffer(addr, capa, offset);
-            break;
-        default:
-            throw new IllegalArgumentException();
+            case IMemorySystem.MMAP_READ_ONLY:
+                wrapped = new ReadOnlyDirectByteBuffer(addr, capa, offset);
+                break;
+            case IMemorySystem.MMAP_READ_WRITE:
+            case IMemorySystem.MMAP_WRITE_COPY:
+                wrapped = new ReadWriteDirectByteBuffer(addr, capa, offset);
+                break;
+            default:
+                throw new IllegalArgumentException();
         }
         addr.autoFree();
     }
 
-	/**
-	 * Returns true if this buffer's content is loaded.
-	 * 
-	 * @return True if this buffer's content is loaded.
-	 */
-	public final boolean isLoaded() {
-		return ((MappedPlatformAddress)((DirectBuffer) wrapped).getBaseAddress()).mmapIsLoaded();
-	}
-
-	/**
-	 * Loads this buffer's content into memory.
-	 * 
-	 * @return This buffer
-	 */
-	public final MappedByteBuffer load() {
-		((MappedPlatformAddress)((DirectBuffer) wrapped).getBaseAddress()).mmapLoad();
-		return this;
-	}
+    /**
+     * Returns true if this buffer's content is loaded.
+     * 
+     * @return True if this buffer's content is loaded.
+     */
+    public final boolean isLoaded() {
+        return ((MappedPlatformAddress) ((DirectBuffer) wrapped)
+                .getBaseAddress()).mmapIsLoaded();
+    }
+
+    /**
+     * Loads this buffer's content into memory.
+     * 
+     * @return This buffer
+     */
+    public final MappedByteBuffer load() {
+        ((MappedPlatformAddress) ((DirectBuffer) wrapped).getBaseAddress())
+                .mmapLoad();
+        return this;
+    }
 
     /**
      * Writes all changes of the buffer to the mapped file.
@@ -100,7 +101,8 @@
      */
     public final MappedByteBuffer force() {
         if (mapMode == IMemorySystem.MMAP_READ_WRITE) {
-            ((MappedPlatformAddress)((DirectBuffer) wrapped).getBaseAddress()).mmapFlush();
+            ((MappedPlatformAddress) ((DirectBuffer) wrapped).getBaseAddress())
+                    .mmapFlush();
         }
         return this;
     }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/MappedByteBufferAdapter.java Fri Sep 21 06:05:59 2007
@@ -20,8 +20,8 @@
 import org.apache.harmony.luni.platform.PlatformAddress;
 import org.apache.harmony.nio.internal.DirectBuffer;
 
-
-final class MappedByteBufferAdapter extends MappedByteBuffer implements DirectBuffer {
+final class MappedByteBufferAdapter extends MappedByteBuffer implements
+        DirectBuffer {
 
     private static final int CHAR_SIZE = 2;
 
@@ -34,280 +34,325 @@
     private static final int FLOAT_SIZE = 4;
 
     private static final int DOUBLE_SIZE = 8;
-    
+
     public MappedByteBufferAdapter(ByteBuffer buffer) {
-		super(buffer);
-	}
+        super(buffer);
+    }
+
+    public MappedByteBufferAdapter(PlatformAddress addr, int capa, int offset,
+            int mode) {
+        super(addr, capa, offset, mode);
+    }
+
+    @Override
+    public CharBuffer asCharBuffer() {
+        return this.wrapped.asCharBuffer();
+    }
+
+    @Override
+    public DoubleBuffer asDoubleBuffer() {
+        return this.wrapped.asDoubleBuffer();
+    }
+
+    @Override
+    public FloatBuffer asFloatBuffer() {
+        return this.wrapped.asFloatBuffer();
+    }
+
+    @Override
+    public IntBuffer asIntBuffer() {
+        return this.wrapped.asIntBuffer();
+    }
+
+    @Override
+    public LongBuffer asLongBuffer() {
+        return this.wrapped.asLongBuffer();
+    }
+
+    @Override
+    public ByteBuffer asReadOnlyBuffer() {
+        MappedByteBufferAdapter buf = new MappedByteBufferAdapter(this.wrapped
+                .asReadOnlyBuffer());
+        buf.limit = this.limit;
+        buf.position = this.position;
+        buf.mark = this.mark;
+        return buf;
+    }
+
+    @Override
+    public ShortBuffer asShortBuffer() {
+        return this.wrapped.asShortBuffer();
+    }
+
+    @Override
+    public ByteBuffer compact() {
+        if (this.wrapped.isReadOnly()) {
+            throw new ReadOnlyBufferException();
+        }
+        this.wrapped.limit(this.limit);
+        this.wrapped.position(this.position);
+        this.wrapped.compact();
+        this.wrapped.clear();
+        this.position = this.limit - this.position;
+        this.limit = this.capacity;
+        this.mark = UNSET_MARK;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer duplicate() {
+        MappedByteBufferAdapter buf = new MappedByteBufferAdapter(this.wrapped
+                .duplicate());
+        buf.limit = this.limit;
+        buf.position = this.position;
+        buf.mark = this.mark;
+        return buf;
+    }
+
+    @Override
+    public byte get() {
+        byte result = this.wrapped.get();
+        this.position++;
+        return result;
+    }
+
+    @Override
+    public byte get(int index) {
+        return this.wrapped.get(index);
+    }
+
+    @Override
+    public char getChar() {
+        char result = this.wrapped.getChar();
+        this.position += CHAR_SIZE;
+        return result;
+    }
+
+    @Override
+    public char getChar(int index) {
+        return this.wrapped.getChar(index);
+    }
+
+    @Override
+    public double getDouble() {
+        double result = this.wrapped.getDouble();
+        this.position += DOUBLE_SIZE;
+        return result;
+    }
+
+    @Override
+    public double getDouble(int index) {
+        return this.wrapped.getDouble(index);
+    }
+
+    public PlatformAddress getEffectiveAddress() {
+        return ((DirectBuffer) this.wrapped).getEffectiveAddress();
+    }
+
+    @Override
+    public float getFloat() {
+        float result = this.wrapped.getFloat();
+        this.position += FLOAT_SIZE;
+        return result;
+    }
+
+    @Override
+    public float getFloat(int index) {
+        return this.wrapped.getFloat(index);
+    }
+
+    @Override
+    public int getInt() {
+        int result = this.wrapped.getInt();
+        this.position += INTEGER_SIZE;
+        return result;
+    }
+
+    @Override
+    public int getInt(int index) {
+        return this.wrapped.getInt(index);
+    }
+
+    @Override
+    public long getLong() {
+        long result = this.wrapped.getLong();
+        this.position += LONG_SIZE;
+        return result;
+    }
+
+    @Override
+    public long getLong(int index) {
+        return this.wrapped.getLong(index);
+    }
+
+    @Override
+    public short getShort() {
+        short result = this.wrapped.getShort();
+        this.position += SHORT_SIZE;
+        return result;
+    }
+
+    @Override
+    public short getShort(int index) {
+        return this.wrapped.getShort(index);
+    }
+
+    @Override
+    public boolean isDirect() {
+        return true;
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return this.wrapped.isReadOnly();
+    }
+
+    @Override
+    ByteBuffer orderImpl(ByteOrder byteOrder) {
+        super.orderImpl(byteOrder);
+        return this.wrapped.order(byteOrder);
+    }
+
+    @Override
+    public ByteBuffer put(byte b) {
+        this.wrapped.put(b);
+        this.position++;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer put(byte[] src, int off, int len) {
+        this.wrapped.position(this.position);
+        this.wrapped.put(src, off, len);
+        this.position += len;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer put(int index, byte b) {
+        this.wrapped.put(index, b);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putChar(char value) {
+        this.wrapped.putChar(value);
+        this.position += CHAR_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putChar(int index, char value) {
+        this.wrapped.putChar(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putDouble(double value) {
+        this.wrapped.putDouble(value);
+        this.position += DOUBLE_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putDouble(int index, double value) {
+        this.wrapped.putDouble(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putFloat(float value) {
+        this.wrapped.putFloat(value);
+        this.position += FLOAT_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putFloat(int index, float value) {
+        this.wrapped.putFloat(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putInt(int index, int value) {
+        this.wrapped.putInt(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putInt(int value) {
+        this.wrapped.putInt(value);
+        this.position += INTEGER_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putLong(int index, long value) {
+        this.wrapped.putLong(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putLong(long value) {
+        this.wrapped.putLong(value);
+        this.position += LONG_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putShort(int index, short value) {
+        this.wrapped.putShort(index, value);
+        return this;
+    }
+
+    @Override
+    public ByteBuffer putShort(short value) {
+        this.wrapped.putShort(value);
+        this.position += SHORT_SIZE;
+        return this;
+    }
+
+    @Override
+    public ByteBuffer slice() {
+        this.wrapped.limit(this.limit);
+        this.wrapped.position(this.position);
+        MappedByteBufferAdapter result = new MappedByteBufferAdapter(
+                this.wrapped.slice());
+        this.wrapped.clear();
+        return result;
+    }
+
+    @Override
+    byte[] protectedArray() {
+        return this.wrapped.protectedArray();
+    }
+
+    @Override
+    int protectedArrayOffset() {
+        return this.wrapped.protectedArrayOffset();
+    }
+
+    @Override
+    boolean protectedHasArray() {
+        return this.wrapped.protectedHasArray();
+    }
+
+    public PlatformAddress getBaseAddress() {
+        return this.wrapped.getBaseAddress();
+    }
+
+    public boolean isAddressValid() {
+        return this.wrapped.isAddressValid();
+    }
+
+    public void addressValidityCheck() {
+        this.wrapped.addressValidityCheck();
+    }
+
+    public void free() {
+        this.wrapped.free();
+    }
 
-	public MappedByteBufferAdapter(PlatformAddress addr, int capa, int offset,
-			int mode) {
-		super(addr, capa, offset, mode);
-	}
-
-	public CharBuffer asCharBuffer() {
-		return this.wrapped.asCharBuffer();
-	}
-
-	public DoubleBuffer asDoubleBuffer() {
-		return this.wrapped.asDoubleBuffer();
-	}
-
-	public FloatBuffer asFloatBuffer() {
-		return this.wrapped.asFloatBuffer();
-	}
-
-	public IntBuffer asIntBuffer() {
-		return this.wrapped.asIntBuffer();
-	}
-
-	public LongBuffer asLongBuffer() {
-		return this.wrapped.asLongBuffer();
-	}
-
-	public ByteBuffer asReadOnlyBuffer() {
-		MappedByteBufferAdapter buf = new MappedByteBufferAdapter(this.wrapped
-				.asReadOnlyBuffer());
-		buf.limit = this.limit;
-		buf.position = this.position;
-		buf.mark = this.mark;
-		return buf;
-	}
-
-	public ShortBuffer asShortBuffer() {
-		return this.wrapped.asShortBuffer();
-	}
-
-	public ByteBuffer compact() {
-		if (this.wrapped.isReadOnly()) {
-			throw new ReadOnlyBufferException();
-		}
-		this.wrapped.limit(this.limit);
-		this.wrapped.position(this.position);
-		this.wrapped.compact();
-		this.wrapped.clear();
-		this.position = this.limit - this.position;
-		this.limit = this.capacity;
-		this.mark = UNSET_MARK;
-		return this;
-	}
-
-	public ByteBuffer duplicate() {
-		MappedByteBufferAdapter buf = new MappedByteBufferAdapter(this.wrapped
-				.duplicate());
-		buf.limit = this.limit;
-		buf.position = this.position;
-		buf.mark = this.mark;
-		return buf;
-	}
-
-	public byte get() {
-		byte result = this.wrapped.get(); 
-		this.position++;
-		return result;
-	}
-
-	public byte get(int index) {
-		return this.wrapped.get(index);
-	}
-
-	public char getChar() {
-		char result = this.wrapped.getChar();
-		this.position += CHAR_SIZE;
-		return result;
-	}
-
-	public char getChar(int index) {
-		return this.wrapped.getChar(index);
-	}
-
-	public double getDouble() {
-		double result = this.wrapped.getDouble();
-		this.position += DOUBLE_SIZE;
-		return result;
-	}
-
-	public double getDouble(int index) {
-		return this.wrapped.getDouble(index);
-	}
-
-	public PlatformAddress getEffectiveAddress() {
-		return ((DirectBuffer) this.wrapped).getEffectiveAddress();
-	}
-
-	public float getFloat() {
-		float result = this.wrapped.getFloat();
-		this.position += FLOAT_SIZE;
-		return result;
-	}
-
-	public float getFloat(int index) {
-		return this.wrapped.getFloat(index);
-	}
-
-	public int getInt() {
-		int result = this.wrapped.getInt();
-		this.position += INTEGER_SIZE;
-		return result;
-	}
-
-	public int getInt(int index) {
-		return this.wrapped.getInt(index);
-	}
-
-	public long getLong() {
-		long result = this.wrapped.getLong();
-		this.position += LONG_SIZE;
-		return result;
-	}
-
-	public long getLong(int index) {
-		return this.wrapped.getLong(index);
-	}
-
-	public short getShort() {
-		short result = this.wrapped.getShort();
-		this.position += SHORT_SIZE;
-		return result;
-	}
-
-	public short getShort(int index) {
-		return this.wrapped.getShort(index);
-	}
-
-	public boolean isDirect() {
-		return true;
-	}
-
-	public boolean isReadOnly() {
-		return this.wrapped.isReadOnly();
-	}
-
-	ByteBuffer orderImpl(ByteOrder byteOrder) {
-		super.orderImpl(byteOrder);
-		return this.wrapped.order(byteOrder);
-	}
-
-	public ByteBuffer put(byte b) {
-		this.wrapped.put(b);
-		this.position++;
-		return this;
-	}
-
-	public ByteBuffer put(byte[] src, int off, int len) {
-		this.wrapped.position(this.position);
-		this.wrapped.put(src, off, len);
-		this.position += len;
-		return this;
-	}
-
-	public ByteBuffer put(int index, byte b) {
-		this.wrapped.put(index, b);
-		return this;
-	}
-
-	public ByteBuffer putChar(char value) {
-		this.wrapped.putChar(value);
-		this.position += CHAR_SIZE;
-		return this;
-	}
-
-	public ByteBuffer putChar(int index, char value) {
-		this.wrapped.putChar(index, value);
-		return this;
-	}
-
-	public ByteBuffer putDouble(double value) {
-		this.wrapped.putDouble(value);
-		this.position += DOUBLE_SIZE;
-		return this;
-	}
-
-	public ByteBuffer putDouble(int index, double value) {
-		this.wrapped.putDouble(index, value);
-		return this;
-	}
-
-	public ByteBuffer putFloat(float value) {
-		this.wrapped.putFloat(value);
-		this.position += FLOAT_SIZE;
-		return this;
-	}
-
-	public ByteBuffer putFloat(int index, float value) {
-		this.wrapped.putFloat(index, value);
-		return this;
-	}
-
-	public ByteBuffer putInt(int index, int value) {
-		this.wrapped.putInt(index, value);
-		return this;
-	}
-
-	public ByteBuffer putInt(int value) {
-		this.wrapped.putInt(value);
-		this.position += INTEGER_SIZE;
-		return this;
-	}
-
-	public ByteBuffer putLong(int index, long value) {
-		this.wrapped.putLong(index, value);
-		return this;
-	}
-
-	public ByteBuffer putLong(long value) {
-		this.wrapped.putLong(value);
-		this.position += LONG_SIZE;
-		return this;
-	}
-
-	public ByteBuffer putShort(int index, short value) {
-		this.wrapped.putShort(index, value);
-		return this;
-	}
-
-	public ByteBuffer putShort(short value) {
-		this.wrapped.putShort(value);
-		this.position += SHORT_SIZE;
-		return this;
-	}
-
-	public ByteBuffer slice() {
-		this.wrapped.limit(this.limit);
-		this.wrapped.position(this.position);
-		MappedByteBufferAdapter result = new MappedByteBufferAdapter(
-				this.wrapped.slice());
-		this.wrapped.clear();
-		return result;
-	}
-
-	byte[] protectedArray() {
-		return this.wrapped.protectedArray();
-	}
-
-	int protectedArrayOffset() {
-		return this.wrapped.protectedArrayOffset();
-	}
-
-	boolean protectedHasArray() {
-		return this.wrapped.protectedHasArray();
-	}
-
-	public PlatformAddress getBaseAddress() {
-		return this.wrapped.getBaseAddress();
-	}
-
-	public boolean isAddressValid() {
-		return this.wrapped.isAddressValid();
-	}
-
-	public void addressValidityCheck() {
-		this.wrapped.addressValidityCheck();
-	}
-
-	public void free() {
-		this.wrapped.free();
-	}
-        
     public int getByteCapacity() {
         return wrapped.getByteCapacity();
     }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyBufferException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyBufferException.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyBufferException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyBufferException.java Fri Sep 21 06:05:59 2007
@@ -16,7 +16,6 @@
 
 package java.nio;
 
-
 /**
  * A <code>ReadOnlyBufferException</code> is thrown when some write operation
  * is called on a readonly buffer.
@@ -24,12 +23,12 @@
  */
 public class ReadOnlyBufferException extends UnsupportedOperationException {
 
-	private static final long serialVersionUID = -1210063976496234090L;
+    private static final long serialVersionUID = -1210063976496234090L;
 
-	/**
-	 * Constructs a <code>ReadOnlyBufferException</code>.
-	 */
-	public ReadOnlyBufferException() {
-		super();
-	}
+    /**
+     * Constructs a <code>ReadOnlyBufferException</code>.
+     */
+    public ReadOnlyBufferException() {
+        super();
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyCharArrayBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyCharArrayBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyCharArrayBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyCharArrayBuffer.java Fri Sep 21 06:05:59 2007
@@ -31,72 +31,86 @@
  */
 final class ReadOnlyCharArrayBuffer extends CharArrayBuffer {
 
-	static ReadOnlyCharArrayBuffer copy(CharArrayBuffer other, int markOfOther) {
-		ReadOnlyCharArrayBuffer buf = new ReadOnlyCharArrayBuffer(other
-				.capacity(), other.backingArray, other.offset);
-		buf.limit = other.limit();
-		buf.position = other.position();
-		buf.mark = markOfOther;
-		return buf;
-	}
-
-	ReadOnlyCharArrayBuffer(int capacity, char[] backingArray, int arrayOffset) {
-		super(capacity, backingArray, arrayOffset);
-	}
-
-	public CharBuffer asReadOnlyBuffer() {
-		return duplicate();
-	}
-
-	public CharBuffer compact() {
-		throw new ReadOnlyBufferException();
-	}
-
-	public CharBuffer duplicate() {
-		return copy(this, mark);
-	}
-
-	public boolean isReadOnly() {
-		return true;
-	}
-
-	protected char[] protectedArray() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected int protectedArrayOffset() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected boolean protectedHasArray() {
-		return false;
-	}
-
-	public CharBuffer put(char c) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public CharBuffer put(int index, char c) {
-		throw new ReadOnlyBufferException();
-	}
+    static ReadOnlyCharArrayBuffer copy(CharArrayBuffer other, int markOfOther) {
+        ReadOnlyCharArrayBuffer buf = new ReadOnlyCharArrayBuffer(other
+                .capacity(), other.backingArray, other.offset);
+        buf.limit = other.limit();
+        buf.position = other.position();
+        buf.mark = markOfOther;
+        return buf;
+    }
+
+    ReadOnlyCharArrayBuffer(int capacity, char[] backingArray, int arrayOffset) {
+        super(capacity, backingArray, arrayOffset);
+    }
+
+    @Override
+    public CharBuffer asReadOnlyBuffer() {
+        return duplicate();
+    }
+
+    @Override
+    public CharBuffer compact() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public CharBuffer duplicate() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    @Override
+    protected char[] protectedArray() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected int protectedArrayOffset() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected boolean protectedHasArray() {
+        return false;
+    }
+
+    @Override
+    public CharBuffer put(char c) {
+        throw new ReadOnlyBufferException();
+    }
 
+    @Override
+    public CharBuffer put(int index, char c) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public final CharBuffer put(char[] src, int off, int len) {
         throw new ReadOnlyBufferException();
     }
-    
+
+    @Override
     public final CharBuffer put(CharBuffer src) {
         throw new ReadOnlyBufferException();
     }
 
+    @Override
     public CharBuffer put(String src, int start, int end) {
-        if ((start < 0 ) || (end < 0) || (long)start + (long)end > src.length()) {
+        if ((start < 0) || (end < 0)
+                || (long) start + (long) end > src.length()) {
             throw new IndexOutOfBoundsException();
         }
         throw new ReadOnlyBufferException();
     }
 
-	public CharBuffer slice() {
-		return new ReadOnlyCharArrayBuffer(remaining(), backingArray, offset
-				+ position);
-	}
+    @Override
+    public CharBuffer slice() {
+        return new ReadOnlyCharArrayBuffer(remaining(), backingArray, offset
+                + position);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDirectByteBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDirectByteBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDirectByteBuffer.java Fri Sep 21 06:05:59 2007
@@ -33,103 +33,122 @@
  */
 final class ReadOnlyDirectByteBuffer extends DirectByteBuffer {
 
-	static ReadOnlyDirectByteBuffer copy(DirectByteBuffer other, int markOfOther) {
-		ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
-				other.safeAddress, other.capacity(), other.offset);
-		buf.limit = other.limit();
-		buf.position = other.position();
-		buf.mark = markOfOther;
-		buf.order(other.order());
-		return buf;
-	}
-
-	protected ReadOnlyDirectByteBuffer(SafeAddress address, int capacity,
-			int offset) {
-		super(address, capacity, offset);
-	}
+    static ReadOnlyDirectByteBuffer copy(DirectByteBuffer other, int markOfOther) {
+        ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
+                other.safeAddress, other.capacity(), other.offset);
+        buf.limit = other.limit();
+        buf.position = other.position();
+        buf.mark = markOfOther;
+        buf.order(other.order());
+        return buf;
+    }
+
+    protected ReadOnlyDirectByteBuffer(SafeAddress address, int capacity,
+            int offset) {
+        super(address, capacity, offset);
+    }
 
     protected ReadOnlyDirectByteBuffer(PlatformAddress address, int capacity,
             int offset) {
         super(new SafeAddress(address), capacity, offset);
     }
-    
-	public ByteBuffer asReadOnlyBuffer() {
-		return copy(this, mark);
-	}
-
-	public ByteBuffer compact() {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer duplicate() {
-		return copy(this, mark);
-	}
-
-	public boolean isReadOnly() {
-		return true;
-	}
-
-	public ByteBuffer put(byte value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer put(int index, byte value) {
-		throw new ReadOnlyBufferException();
-	}
 
+    @Override
+    public ByteBuffer asReadOnlyBuffer() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public ByteBuffer compact() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer duplicate() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    @Override
+    public ByteBuffer put(byte value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer put(int index, byte value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public ByteBuffer put(byte[] src, int off, int len) {
         throw new ReadOnlyBufferException();
     }
-    
-	public ByteBuffer putDouble(double value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putDouble(int index, double value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putFloat(float value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putFloat(int index, float value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putInt(int value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putInt(int index, int value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putLong(int index, long value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putLong(long value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putShort(int index, short value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putShort(short value) {
-		throw new ReadOnlyBufferException();
-	}
-    
+
+    @Override
+    public ByteBuffer putDouble(double value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putDouble(int index, double value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putFloat(float value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putFloat(int index, float value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putInt(int value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putInt(int index, int value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putLong(int index, long value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putLong(long value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putShort(int index, short value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putShort(short value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public ByteBuffer put(ByteBuffer buf) {
         throw new ReadOnlyBufferException();
     }
 
-	public ByteBuffer slice() {
-		ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
-				safeAddress, remaining(), offset + position);
-		buf.order = order;
-		return buf;
-	}
+    @Override
+    public ByteBuffer slice() {
+        ReadOnlyDirectByteBuffer buf = new ReadOnlyDirectByteBuffer(
+                safeAddress, remaining(), offset + position);
+        buf.order = order;
+        return buf;
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDoubleArrayBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDoubleArrayBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDoubleArrayBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyDoubleArrayBuffer.java Fri Sep 21 06:05:59 2007
@@ -31,68 +31,80 @@
  */
 final class ReadOnlyDoubleArrayBuffer extends DoubleArrayBuffer {
 
-	static ReadOnlyDoubleArrayBuffer copy(DoubleArrayBuffer other,
-			int markOfOther) {
-		ReadOnlyDoubleArrayBuffer buf = new ReadOnlyDoubleArrayBuffer(other
-				.capacity(), other.backingArray, other.offset);
-		buf.limit = other.limit();
-		buf.position = other.position();
-		buf.mark = markOfOther;
-		return buf;
-	}
-
-	ReadOnlyDoubleArrayBuffer(int capacity, double[] backingArray,
-			int arrayOffset) {
-		super(capacity, backingArray, arrayOffset);
-	}
-
-	public DoubleBuffer asReadOnlyBuffer() {
-		return duplicate();
-	}
-
-	public DoubleBuffer compact() {
-		throw new ReadOnlyBufferException();
-	}
-
-	public DoubleBuffer duplicate() {
-		return copy(this, mark);
-	}
-
-	public boolean isReadOnly() {
-		return true;
-	}
-
-	protected double[] protectedArray() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected int protectedArrayOffset() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected boolean protectedHasArray() {
-		return false;
-	}
-
-	public DoubleBuffer put(double c) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public DoubleBuffer put(int index, double c) {
-		throw new ReadOnlyBufferException();
-	}
+    static ReadOnlyDoubleArrayBuffer copy(DoubleArrayBuffer other,
+            int markOfOther) {
+        ReadOnlyDoubleArrayBuffer buf = new ReadOnlyDoubleArrayBuffer(other
+                .capacity(), other.backingArray, other.offset);
+        buf.limit = other.limit();
+        buf.position = other.position();
+        buf.mark = markOfOther;
+        return buf;
+    }
+
+    ReadOnlyDoubleArrayBuffer(int capacity, double[] backingArray,
+            int arrayOffset) {
+        super(capacity, backingArray, arrayOffset);
+    }
+
+    @Override
+    public DoubleBuffer asReadOnlyBuffer() {
+        return duplicate();
+    }
+
+    @Override
+    public DoubleBuffer compact() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public DoubleBuffer duplicate() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    @Override
+    protected double[] protectedArray() {
+        throw new ReadOnlyBufferException();
+    }
 
+    @Override
+    protected int protectedArrayOffset() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected boolean protectedHasArray() {
+        return false;
+    }
+
+    @Override
+    public DoubleBuffer put(double c) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public DoubleBuffer put(int index, double c) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public final DoubleBuffer put(double[] src, int off, int len) {
         throw new ReadOnlyBufferException();
     }
-    
+
+    @Override
     public final DoubleBuffer put(DoubleBuffer buf) {
         throw new ReadOnlyBufferException();
     }
-    
-	public DoubleBuffer slice() {
-		return new ReadOnlyDoubleArrayBuffer(remaining(), backingArray, offset
-				+ position);
-	}
+
+    @Override
+    public DoubleBuffer slice() {
+        return new ReadOnlyDoubleArrayBuffer(remaining(), backingArray, offset
+                + position);
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyFloatArrayBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyFloatArrayBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyFloatArrayBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyFloatArrayBuffer.java Fri Sep 21 06:05:59 2007
@@ -31,66 +31,78 @@
  */
 final class ReadOnlyFloatArrayBuffer extends FloatArrayBuffer {
 
-	static ReadOnlyFloatArrayBuffer copy(FloatArrayBuffer other, int markOfOther) {
-		ReadOnlyFloatArrayBuffer buf = new ReadOnlyFloatArrayBuffer(other
-				.capacity(), other.backingArray, other.offset);
-		buf.limit = other.limit();
-		buf.position = other.position();
-		buf.mark = markOfOther;
-		return buf;
-	}
-
-	ReadOnlyFloatArrayBuffer(int capacity, float[] backingArray, int arrayOffset) {
-		super(capacity, backingArray, arrayOffset);
-	}
-
-	public FloatBuffer asReadOnlyBuffer() {
-		return duplicate();
-	}
-
-	public FloatBuffer compact() {
-		throw new ReadOnlyBufferException();
-	}
-
-	public FloatBuffer duplicate() {
-		return copy(this, mark);
-	}
-
-	public boolean isReadOnly() {
-		return true;
-	}
-
-	protected float[] protectedArray() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected int protectedArrayOffset() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected boolean protectedHasArray() {
-		return false;
-	}
-
-	public FloatBuffer put(float c) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public FloatBuffer put(int index, float c) {
-		throw new ReadOnlyBufferException();
-	}
-    
+    static ReadOnlyFloatArrayBuffer copy(FloatArrayBuffer other, int markOfOther) {
+        ReadOnlyFloatArrayBuffer buf = new ReadOnlyFloatArrayBuffer(other
+                .capacity(), other.backingArray, other.offset);
+        buf.limit = other.limit();
+        buf.position = other.position();
+        buf.mark = markOfOther;
+        return buf;
+    }
+
+    ReadOnlyFloatArrayBuffer(int capacity, float[] backingArray, int arrayOffset) {
+        super(capacity, backingArray, arrayOffset);
+    }
+
+    @Override
+    public FloatBuffer asReadOnlyBuffer() {
+        return duplicate();
+    }
+
+    @Override
+    public FloatBuffer compact() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public FloatBuffer duplicate() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    @Override
+    protected float[] protectedArray() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected int protectedArrayOffset() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected boolean protectedHasArray() {
+        return false;
+    }
+
+    @Override
+    public FloatBuffer put(float c) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public FloatBuffer put(int index, float c) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public FloatBuffer put(FloatBuffer buf) {
         throw new ReadOnlyBufferException();
     }
 
+    @Override
     public final FloatBuffer put(float[] src, int off, int len) {
         throw new ReadOnlyBufferException();
     }
-    
-	public FloatBuffer slice() {
-		return new ReadOnlyFloatArrayBuffer(remaining(), backingArray, offset
-				+ position);
-	}
+
+    @Override
+    public FloatBuffer slice() {
+        return new ReadOnlyFloatArrayBuffer(remaining(), backingArray, offset
+                + position);
+    }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyHeapByteBuffer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyHeapByteBuffer.java?rev=578091&r1=578090&r2=578091&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyHeapByteBuffer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/ReadOnlyHeapByteBuffer.java Fri Sep 21 06:05:59 2007
@@ -31,108 +31,130 @@
  */
 final class ReadOnlyHeapByteBuffer extends HeapByteBuffer {
 
-	static ReadOnlyHeapByteBuffer copy(HeapByteBuffer other, int markOfOther) {
-		ReadOnlyHeapByteBuffer buf = new ReadOnlyHeapByteBuffer(
-				other.backingArray, other.capacity(), other.offset);
-		buf.limit = other.limit();
-		buf.position = other.position();
-		buf.mark = markOfOther;
-		buf.order(other.order());
-		return buf;
-	}
-
-	ReadOnlyHeapByteBuffer(byte[] backingArray, int capacity, int arrayOffset) {
-		super(backingArray, capacity, arrayOffset);
-	}
-
-	public ByteBuffer asReadOnlyBuffer() {
-		return copy(this, mark);
-	}
-
-	public ByteBuffer compact() {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer duplicate() {
-		return copy(this, mark);
-	}
-
-	public boolean isReadOnly() {
-		return true;
-	}
-
-	protected byte[] protectedArray() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected int protectedArrayOffset() {
-		throw new ReadOnlyBufferException();
-	}
-
-	protected boolean protectedHasArray() {
-		return false;
-	}
-
-	public ByteBuffer put(byte b) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer put(int index, byte b) {
-		throw new ReadOnlyBufferException();
-	}
+    static ReadOnlyHeapByteBuffer copy(HeapByteBuffer other, int markOfOther) {
+        ReadOnlyHeapByteBuffer buf = new ReadOnlyHeapByteBuffer(
+                other.backingArray, other.capacity(), other.offset);
+        buf.limit = other.limit();
+        buf.position = other.position();
+        buf.mark = markOfOther;
+        buf.order(other.order());
+        return buf;
+    }
+
+    ReadOnlyHeapByteBuffer(byte[] backingArray, int capacity, int arrayOffset) {
+        super(backingArray, capacity, arrayOffset);
+    }
+
+    @Override
+    public ByteBuffer asReadOnlyBuffer() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public ByteBuffer compact() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer duplicate() {
+        return copy(this, mark);
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    @Override
+    protected byte[] protectedArray() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected int protectedArrayOffset() {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    protected boolean protectedHasArray() {
+        return false;
+    }
+
+    @Override
+    public ByteBuffer put(byte b) {
+        throw new ReadOnlyBufferException();
+    }
 
+    @Override
+    public ByteBuffer put(int index, byte b) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public ByteBuffer put(byte[] src, int off, int len) {
         throw new ReadOnlyBufferException();
     }
-    
-	public ByteBuffer putDouble(double value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putDouble(int index, double value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putFloat(float value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putFloat(int index, float value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putInt(int value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putInt(int index, int value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putLong(int index, long value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putLong(long value) {
-		throw new ReadOnlyBufferException();
-	}
-
-	public ByteBuffer putShort(int index, short value) {
-		throw new ReadOnlyBufferException();
-	}
 
+    @Override
+    public ByteBuffer putDouble(double value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putDouble(int index, double value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putFloat(float value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putFloat(int index, float value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putInt(int value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putInt(int index, int value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putLong(int index, long value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putLong(long value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
+    public ByteBuffer putShort(int index, short value) {
+        throw new ReadOnlyBufferException();
+    }
+
+    @Override
     public ByteBuffer putShort(short value) {
         throw new ReadOnlyBufferException();
     }
-    
+
+    @Override
     public ByteBuffer put(ByteBuffer buf) {
         throw new ReadOnlyBufferException();
     }
 
-	public ByteBuffer slice() {
-		ReadOnlyHeapByteBuffer slice = new ReadOnlyHeapByteBuffer(backingArray,
-				remaining(), offset + position);
-		slice.order = order;
-		return slice;
-	}
+    @Override
+    public ByteBuffer slice() {
+        ReadOnlyHeapByteBuffer slice = new ReadOnlyHeapByteBuffer(backingArray,
+                remaining(), offset + position);
+        slice.order = order;
+        return slice;
+    }
 }



Mime
View raw message