This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH] java.nio fixes
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 19 Feb 2003 13:55:07 +0100
- Subject: [PATCH] java.nio fixes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to fix some oddities in java.nio and
friends.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+U36rWSOgCCdjSDsRAkl1AJwN5Jb0GoVvYycb9HGdAVIxMOL4egCfb9sh
jz9G9gfcSjWPqLN3A+5O+cs=
=Znfx
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1719
diff -u -r1.1719 ChangeLog
--- ChangeLog 19 Feb 2003 11:44:21 -0000 1.1719
+++ ChangeLog 19 Feb 2003 11:47:22 -0000
@@ -1,5 +1,37 @@
2003-02-19 Michael Koch <konqueror at gmx dot de>
+ * gnu/java/nio/ByteBufferImpl.java
+ (ByteBufferImpl): Renamed two variables.
+ * gnu/java/nio/CharBufferImpl.java
+ (CharBufferImpl): Renamed two variables.
+ * gnu/java/nio/DoubleBufferImpl.java
+ (DoubleBufferImpl): Renamed two variables.
+ * gnu/java/nio/FloatBufferImpl.java
+ (FloatBufferImpl): Renamed two variables.
+ * gnu/java/nio/IntBufferImpl.java
+ (IntBufferImpl): Renamed two variables.
+ * gnu/java/nio/LongBufferImpl.java
+ (LongBufferImpl): Renamed two variables.
+ * gnu/java/nio/ShortBufferImpl.java
+ (ShortBufferImpl): Renamed two variables.
+ * java/nio/CharBuffer.java
+ (wrap): Fixed arguments to CharBufferImpl constructor.
+ (hasArray): Only not read-only buffers have backing arrays.
+ (length): Documentation added.
+ (subSequence): Documentation added.
+ * java/nio/DoubleBuffer.java
+ (hasArray): Only not read-only buffers have backing arrays.
+ * java/nio/FloatBuffer.java
+ (hasArray): Only not read-only buffers have backing arrays.
+ * java/nio/IntBuffer.java
+ (hasArray): Only not read-only buffers have backing arrays.
+ * java/nio/LongBuffer.java
+ (hasArray): Only not read-only buffers have backing arrays.
+ * java/nio/ShortBuffer.java
+ (hasArray): Only not read-only buffers have backing arrays.
+
+2003-02-19 Michael Koch <konqueror at gmx dot de>
+
* javax/accessibility/AccessibleContext.java
(ACCESSIBLE_DESCRIPTION_PROPERTY): Fixed typo.
Index: gnu/java/nio/ByteBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/ByteBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 ByteBufferImpl.java
--- gnu/java/nio/ByteBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/ByteBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -60,9 +60,9 @@
readOnly = false;
}
- public ByteBufferImpl (byte[] array, int off, int lim)
+ public ByteBufferImpl (byte[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/CharBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/CharBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 CharBufferImpl.java
--- gnu/java/nio/CharBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/CharBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public CharBufferImpl(char[] array, int off, int lim)
+ public CharBufferImpl(char[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/DoubleBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/DoubleBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 DoubleBufferImpl.java
--- gnu/java/nio/DoubleBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/DoubleBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public DoubleBufferImpl(double[] array, int off, int lim)
+ public DoubleBufferImpl(double[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/FloatBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/FloatBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 FloatBufferImpl.java
--- gnu/java/nio/FloatBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/FloatBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public FloatBufferImpl(float[] array, int off, int lim)
+ public FloatBufferImpl(float[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/IntBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/IntBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 IntBufferImpl.java
--- gnu/java/nio/IntBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/IntBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public IntBufferImpl(int[] array, int off, int lim)
+ public IntBufferImpl(int[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/LongBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/LongBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 LongBufferImpl.java
--- gnu/java/nio/LongBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/LongBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public LongBufferImpl(long[] array, int off, int lim)
+ public LongBufferImpl(long[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: gnu/java/nio/ShortBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/ShortBufferImpl.java,v
retrieving revision 1.3
diff -u -r1.3 ShortBufferImpl.java
--- gnu/java/nio/ShortBufferImpl.java 11 Feb 2003 11:16:18 -0000 1.3
+++ gnu/java/nio/ShortBufferImpl.java 19 Feb 2003 11:47:22 -0000
@@ -56,9 +56,9 @@
readOnly = false;
}
- public ShortBufferImpl(short[] array, int off, int lim)
+ public ShortBufferImpl(short[] array, int offset, int length)
{
- super (array.length, lim, off, 0);
+ super (array.length, length, offset, 0);
this.backing_buffer = array;
readOnly = false;
}
Index: java/nio/CharBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/CharBuffer.java,v
retrieving revision 1.5
diff -u -r1.5 CharBuffer.java
--- java/nio/CharBuffer.java 13 Feb 2003 11:37:10 -0000 1.5
+++ java/nio/CharBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -63,7 +63,7 @@
*/
final public static CharBuffer wrap (char[] array, int offset, int length)
{
- return new CharBufferImpl (array, offset, offset + length);
+ return new CharBufferImpl (array, offset, length);
}
/**
@@ -205,7 +205,8 @@
*/
public final boolean hasArray ()
{
- return backing_buffer != null;
+ return (backing_buffer != null
+ && ! isReadOnly ());
}
/**
@@ -359,6 +360,9 @@
return new String (array (), position (), length ());
}
+ /**
+ * Returns the length of the remaining chars in this buffer.
+ */
public final int length ()
{
return remaining ();
@@ -370,6 +374,9 @@
public abstract ByteOrder order ();
/**
+ * Creates a new character buffer that represents the specified subsequence
+ * of this buffer, relative to the current position.
+ *
* @exception IndexOutOfBoundsException If the preconditions on start and
* end do not hold.
*/
Index: java/nio/DoubleBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/DoubleBuffer.java,v
retrieving revision 1.4
diff -u -r1.4 DoubleBuffer.java
--- java/nio/DoubleBuffer.java 13 Feb 2003 08:40:35 -0000 1.4
+++ java/nio/DoubleBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -120,7 +120,8 @@
public final boolean hasArray()
{
- return (backing_buffer != null);
+ return (backing_buffer != null
+ && !isReadOnly ());
}
public final double[] array()
Index: java/nio/FloatBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/FloatBuffer.java,v
retrieving revision 1.4
diff -u -r1.4 FloatBuffer.java
--- java/nio/FloatBuffer.java 13 Feb 2003 08:40:35 -0000 1.4
+++ java/nio/FloatBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -121,7 +121,8 @@
public final boolean hasArray()
{
- return (backing_buffer != null);
+ return (backing_buffer != null
+ && !isReadOnly ());
}
public final float[] array()
Index: java/nio/IntBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/IntBuffer.java,v
retrieving revision 1.4
diff -u -r1.4 IntBuffer.java
--- java/nio/IntBuffer.java 13 Feb 2003 08:40:35 -0000 1.4
+++ java/nio/IntBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -121,7 +121,8 @@
public final boolean hasArray()
{
- return (backing_buffer != null);
+ return (backing_buffer != null
+ && !isReadOnly ());
}
public final int[] array()
Index: java/nio/LongBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/LongBuffer.java,v
retrieving revision 1.4
diff -u -r1.4 LongBuffer.java
--- java/nio/LongBuffer.java 13 Feb 2003 08:40:35 -0000 1.4
+++ java/nio/LongBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -121,7 +121,8 @@
public final boolean hasArray()
{
- return (backing_buffer != null);
+ return (backing_buffer != null
+ && !isReadOnly ());
}
public final long[] array()
Index: java/nio/ShortBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/ShortBuffer.java,v
retrieving revision 1.4
diff -u -r1.4 ShortBuffer.java
--- java/nio/ShortBuffer.java 13 Feb 2003 08:40:35 -0000 1.4
+++ java/nio/ShortBuffer.java 19 Feb 2003 11:47:22 -0000
@@ -121,7 +121,8 @@
public final boolean hasArray()
{
- return (backing_buffer != null);
+ return (backing_buffer != null
+ && !isReadOnly ());
}
public final short[] array()