This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch] Fixes for gnu.java.nio
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 29 Nov 2002 08:51:40 +0100
- Subject: [Patch] Fixes for gnu.java.nio
Hello list,
I commit this patch for gnu.java.nio. It Fixes all *BufferImpl
classes. These classes are currently not compiled in Makefile.am from
CVS.
Michael
--
Homepage: http://www.worldforge.org/
GPG-key: http://konqueror.dyndns.org/~mkoch/michael.gpg
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1563
diff -b -u -r1.1563 ChangeLog
--- ChangeLog 27 Nov 2002 22:41:05 -0000 1.1563
+++ ChangeLog 29 Nov 2002 07:46:02 -0000
@@ -1,3 +1,34 @@
+2002-11-29 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/ByteBufferImpl.java
+ (ByteBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/CharBufferImpl.java:
+ Reformated.
+ (endian): New member variable string endianess of buffer.
+ (CharBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ (subSequence): Implemented.
+ * gnu/java/nio/DoubleBufferImpl.java
+ (DoubleBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/FloatBufferImpl.java
+ Reformated.
+ (FloatBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/IntBufferImpl.java
+ Added needed imports, Reformated.
+ (IntBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/LongBufferImpl.java
+ Reformated.
+ (LongBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+ * gnu/java/nio/ShortBufferImpl.java
+ Reformated.
+ (ShortBufferImpl): Moved position() after limit.
+ (nio_*): Use native implementation.
+
2002-11-27 Julian Dolby <dolby@us.ibm.com>
* java/util/Locale.java (toString): Improve efficiency if country
Index: gnu/java/nio/ByteBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/ByteBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 ByteBufferImpl.java
--- gnu/java/nio/ByteBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/ByteBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -54,24 +54,24 @@
public ByteBufferImpl (int cap, int off, int lim)
{
this.cap = cap;
- position (off);
limit (lim);
+ position (off);
this.backing_buffer = new byte[cap];
}
public ByteBufferImpl (byte[] array, int off, int lim)
{
this.cap = array.length;
- position (off);
limit (lim);
+ position (off);
this.backing_buffer = array;
}
public ByteBufferImpl (ByteBufferImpl copy)
{
this.cap = copy.capacity ();
- position (copy.position ());
limit (copy.limit ());
+ position (copy.position ());
ro = copy.ro;
backing_buffer = copy.backing_buffer;
}
@@ -81,69 +81,48 @@
position (position () + toAdd);
}
-// private static native byte[] nio_cast(byte[]copy);
-// private static native byte[] nio_cast(char[]copy);
-// private static native byte[] nio_cast(short[]copy);
-// private static native byte[] nio_cast(long[]copy);
-// private static native byte[] nio_cast(int[]copy);
-// private static native byte[] nio_cast(float[]copy);
-// private static native byte[] nio_cast(double[]copy);
-
- private static byte[] nio_cast(byte[]copy) { return null; };
- private static byte[] nio_cast(char[]copy) { return null; };
- private static byte[] nio_cast(short[]copy) { return null; };
- private static byte[] nio_cast(long[]copy) { return null; };
- private static byte[] nio_cast(int[]copy) { return null; };
- private static byte[] nio_cast(float[]copy) { return null; };
- private static byte[] nio_cast(double[]copy) { return null; };
+ private static native byte[] nio_cast(byte[]copy);
+ private static native byte[] nio_cast(char[]copy);
+ private static native byte[] nio_cast(short[]copy);
+ private static native byte[] nio_cast(long[]copy);
+ private static native byte[] nio_cast(int[]copy);
+ private static native byte[] nio_cast(float[]copy);
+ private static native byte[] nio_cast(double[]copy);
+
ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(ByteBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value) { };
+ private static native byte nio_get_Byte(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(ByteBufferImpl b, int index, int limit, byte value);
public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/1); return res; }
ByteBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(ByteBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(ByteBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(ByteBufferImpl b, int index, int limit, char value) { };
+ private static native char nio_get_Char(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(ByteBufferImpl b, int index, int limit, char value);
public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
ByteBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(ByteBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(ByteBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(ByteBufferImpl b, int index, int limit, short value) { };
+ private static native short nio_get_Short(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(ByteBufferImpl b, int index, int limit, short value);
public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; }
ByteBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(ByteBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(ByteBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(ByteBufferImpl b, int index, int limit, int value) { };
+ private static native int nio_get_Int(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(ByteBufferImpl b, int index, int limit, int value);
public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
ByteBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(ByteBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(ByteBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(ByteBufferImpl b, int index, int limit, long value) { };
+ private static native long nio_get_Long(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(ByteBufferImpl b, int index, int limit, long value);
public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
ByteBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(ByteBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(ByteBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(ByteBufferImpl b, int index, int limit, float value) { };
+ private static native float nio_get_Float(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(ByteBufferImpl b, int index, int limit, float value);
public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; }
ByteBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(ByteBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(ByteBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(ByteBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(ByteBufferImpl b, int index, int limit, double value) { };
+ private static native double nio_get_Double(ByteBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(ByteBufferImpl b, int index, int limit, double value);
public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
public boolean isReadOnly()
Index: gnu/java/nio/CharBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/CharBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 CharBufferImpl.java
--- gnu/java/nio/CharBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/CharBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -48,31 +48,32 @@
public final class CharBufferImpl extends CharBuffer
{
- private int array_offset;
private boolean ro;
+ private ByteOrder endian = ByteOrder.BIG_ENDIAN;
+
public CharBufferImpl(int cap, int off, int lim)
{
this.backing_buffer = new char[cap];
this.cap = cap;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public CharBufferImpl(char[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public CharBufferImpl (CharBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position (copy.position ());
limit (copy.limit());
+ position (copy.position ());
}
void inc_pos (int a)
@@ -80,144 +81,132 @@
position (position () + a);
}
-// private static native char[] nio_cast(byte[]copy);
-// private static native char[] nio_cast(char[]copy);
-// private static native char[] nio_cast(short[]copy);
-// private static native char[] nio_cast(long[]copy);
-// private static native char[] nio_cast(int[]copy);
-// private static native char[] nio_cast(float[]copy);
-// private static native char[] nio_cast(double[]copy);
-
- private static char[] nio_cast(byte[]copy) { return null; };
- private static char[] nio_cast(char[]copy) { return null; };
- private static char[] nio_cast(short[]copy) { return null; };
- private static char[] nio_cast(long[]copy) { return null; };
- private static char[] nio_cast(int[]copy) { return null; };
- private static char[] nio_cast(float[]copy) { return null; };
- private static char[] nio_cast(double[]copy) { return null; };
-
CharBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(CharBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(CharBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(CharBufferImpl b, int index, int limit, byte value) { };
- public java.nio. ByteBuffer asByteBuffer() { gnu.java.nio. ByteBufferImpl res = new gnu.java.nio. ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
+ private static native byte nio_get_Byte(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(CharBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
CharBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(CharBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(CharBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(CharBufferImpl b, int index, int limit, char value) { };
- public java.nio. CharBuffer asCharBuffer() { gnu.java.nio. CharBufferImpl res = new gnu.java.nio. CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+ private static native char nio_get_Char(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(CharBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
CharBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(CharBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(CharBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(CharBufferImpl b, int index, int limit, short value) { };
- public java.nio. ShortBuffer asShortBuffer() { gnu.java.nio. ShortBufferImpl res = new gnu.java.nio. ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+ private static native short nio_get_Short(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(CharBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
CharBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(CharBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(CharBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(CharBufferImpl b, int index, int limit, int value) { };
- public java.nio. IntBuffer asIntBuffer() { gnu.java.nio. IntBufferImpl res = new gnu.java.nio. IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+ private static native int nio_get_Int(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(CharBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
CharBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(CharBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(CharBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(CharBufferImpl b, int index, int limit, long value) { };
- public java.nio. LongBuffer asLongBuffer() { gnu.java.nio. LongBufferImpl res = new gnu.java.nio. LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+ private static native long nio_get_Long(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(CharBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
CharBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(CharBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(CharBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(CharBufferImpl b, int index, int limit, float value) { };
- public java.nio. FloatBuffer asFloatBuffer() { gnu.java.nio. FloatBufferImpl res = new gnu.java.nio. FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+ private static native float nio_get_Float(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(CharBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
CharBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(CharBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(CharBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(CharBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(CharBufferImpl b, int index, int limit, double value) { };
- public java.nio. DoubleBuffer asDoubleBuffer() { gnu.java.nio. DoubleBufferImpl res = new gnu.java.nio. DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+ private static native double nio_get_Double(CharBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(CharBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ private static native char[] nio_cast(byte[]copy);
+ private static native char[] nio_cast(char[]copy);
+ private static native char[] nio_cast(short[]copy);
+ private static native char[] nio_cast(long[]copy);
+ private static native char[] nio_cast(int[]copy);
+ private static native char[] nio_cast(float[]copy);
+ private static native char[] nio_cast(double[]copy);
+
public boolean isReadOnly()
{
return ro;
}
+
public CharBuffer slice()
{
- CharBufferImpl A = new CharBufferImpl(this);
- A.array_offset = position();
- return A;
+ CharBufferImpl buffer = new CharBufferImpl (this);
+ buffer.array_offset = position ();
+ return buffer;
}
+
public CharBuffer duplicate()
{
return new CharBufferImpl(this);
}
+
public CharBuffer asReadOnlyBuffer()
{
CharBufferImpl a = new CharBufferImpl(this);
a.ro = true;
return a;
}
+
public CharBuffer compact()
{
return this;
}
+
public boolean isDirect()
{
return backing_buffer != null;
}
+
+ final public CharSequence subSequence (int start, int end)
+ {
+ if (start < 0 ||
+ end > length () ||
+ start > end)
+ throw new IndexOutOfBoundsException ();
+
+ // No support for direct buffers yet.
+ // assert array () != null;
+ return new CharBufferImpl (array (), position () + start,
+ position () + end);
+ }
+
final public char get()
{
char e = backing_buffer[position()];
position(position()+1);
return e;
}
+
final public CharBuffer put(char b)
{
backing_buffer[position()] = b;
position(position()+1);
return this;
}
+
+ final public char getChar() { return get(); } final public CharBuffer putChar(char value) { return put(value); } final public char getChar(int index) { return get(index); } final public CharBuffer putChar(int index, char value) { return put(index, value); };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public CharBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public CharBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public CharBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public CharBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public CharBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public CharBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public CharBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public CharBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public CharBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public CharBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+
final public char get(int index)
{
return backing_buffer[index];
}
- final public java.nio. CharBuffer put(int index, char b)
+
+ final public CharBuffer put(int index, char b)
{
backing_buffer[index] = b;
return this;
}
- final public char getChar() { return get(); } final public java.nio. CharBuffer putChar(char value) { return put(value); } final public char getChar(int index) { return get(index); } final public java.nio. CharBuffer putChar(int index, char value) { return put(index, value); };
- final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public java.nio. CharBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public java.nio. CharBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
- final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public java.nio. CharBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public java.nio. CharBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
- final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public java.nio. CharBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public java.nio. CharBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
- final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public java.nio. CharBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public java.nio. CharBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
- final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. CharBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. CharBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
-
- public String toString()
- {
- if (backing_buffer != null)
- {
- return new String(backing_buffer, position(), limit());
- }
- return super.toString();
- }
public final ByteOrder order()
{
return endian;
- }
-
- public CharSequence subSequence(int a, int b)
- {
- return null;
}
}
Index: gnu/java/nio/DoubleBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/DoubleBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 DoubleBufferImpl.java
--- gnu/java/nio/DoubleBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/DoubleBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -54,24 +54,24 @@
{
this.backing_buffer = new double[cap];
this.cap = cap;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public DoubleBufferImpl(double[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public DoubleBufferImpl(DoubleBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position(copy.position());
limit(copy.limit());
+ position(copy.position());
}
void inc_pos(int a)
@@ -79,70 +79,48 @@
position(position() + a);
}
-// private static native double[] nio_cast(byte[]copy);
-// private static native double[] nio_cast(char[]copy);
-// private static native double[] nio_cast(short[]copy);
-// private static native double[] nio_cast(long[]copy);
-// private static native double[] nio_cast(int[]copy);
-// private static native double[] nio_cast(float[]copy);
-// private static native double[] nio_cast(double[]copy);
-
- private static double[] nio_cast(byte[]copy) { return null; };
- private static double[] nio_cast(char[]copy) { return null; };
- private static double[] nio_cast(short[]copy) { return null; };
- private static double[] nio_cast(long[]copy) { return null; };
- private static double[] nio_cast(int[]copy) { return null; };
- private static double[] nio_cast(float[]copy) { return null; };
- private static double[] nio_cast(double[]copy) { return null; };
-
DoubleBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(DoubleBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(DoubleBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(DoubleBufferImpl b, int index, int limit, byte value) { };
+ private static native byte nio_get_Byte(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(DoubleBufferImpl b, int index, int limit, byte value);
public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; }
DoubleBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(DoubleBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(DoubleBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(DoubleBufferImpl b, int index, int limit, char value) { };
+ private static native char nio_get_Char(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(DoubleBufferImpl b, int index, int limit, char value);
public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
DoubleBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(DoubleBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(DoubleBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(DoubleBufferImpl b, int index, int limit, short value) { };
+ private static native short nio_get_Short(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(DoubleBufferImpl b, int index, int limit, short value);
public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
DoubleBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(DoubleBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(DoubleBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(DoubleBufferImpl b, int index, int limit, int value) { };
+ private static native int nio_get_Int(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(DoubleBufferImpl b, int index, int limit, int value);
public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
DoubleBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(DoubleBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(DoubleBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(DoubleBufferImpl b, int index, int limit, long value) { };
+ private static native long nio_get_Long(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(DoubleBufferImpl b, int index, int limit, long value);
public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
DoubleBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(DoubleBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(DoubleBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(DoubleBufferImpl b, int index, int limit, float value) { };
+ private static native float nio_get_Float(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(DoubleBufferImpl b, int index, int limit, float value);
public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
DoubleBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(DoubleBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(DoubleBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(DoubleBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(DoubleBufferImpl b, int index, int limit, double value) { };
+ private static native double nio_get_Double(DoubleBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(DoubleBufferImpl b, int index, int limit, double value);
public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ private static native double[] nio_cast(byte[]copy);
+ private static native double[] nio_cast(char[]copy);
+ private static native double[] nio_cast(short[]copy);
+ private static native double[] nio_cast(long[]copy);
+ private static native double[] nio_cast(int[]copy);
+ private static native double[] nio_cast(float[]copy);
+ private static native double[] nio_cast(double[]copy);
public boolean isReadOnly()
{
Index: gnu/java/nio/FloatBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/FloatBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 FloatBufferImpl.java
--- gnu/java/nio/FloatBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/FloatBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -54,24 +54,24 @@
{
this.backing_buffer = new float[cap];
this.cap = cap;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public FloatBufferImpl(float[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public FloatBufferImpl(FloatBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position(copy.position());
limit(copy.limit());
+ position(copy.position());
}
void inc_pos(int a)
@@ -79,27 +79,9 @@
position(position() + a);
}
-// private static native float[] nio_cast(byte[]copy);
-// private static native float[] nio_cast(char[]copy);
-// private static native float[] nio_cast(short[]copy);
-// private static native float[] nio_cast(long[]copy);
-// private static native float[] nio_cast(int[]copy);
-// private static native float[] nio_cast(float[]copy);
-// private static native float[] nio_cast(double[]copy);
-
- private static float[] nio_cast(byte[]copy) { return null; };
- private static float[] nio_cast(char[]copy) { return null; };
- private static float[] nio_cast(short[]copy) { return null; };
- private static float[] nio_cast(long[]copy) { return null; };
- private static float[] nio_cast(int[]copy) { return null; };
- private static float[] nio_cast(float[]copy) { return null; };
- private static float[] nio_cast(double[]copy) { return null; };
-
FloatBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast (copy) : null; }
-// private static native byte nio_get_Byte (FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte (FloatBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte (FloatBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte (FloatBufferImpl b, int index, int limit, byte value) { };
+ private static native byte nio_get_Byte (FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte (FloatBufferImpl b, int index, int limit, byte value);
public ByteBuffer asByteBuffer()
{
@@ -109,72 +91,68 @@
}
FloatBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(FloatBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(FloatBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(FloatBufferImpl b, int index, int limit, char value) { };
+ private static native char nio_get_Char(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(FloatBufferImpl b, int index, int limit, char value);
public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
FloatBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(FloatBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(FloatBufferImpl b, int index, int limit) { return 0;};
- private static void nio_put_Short(FloatBufferImpl b, int index, int limit, short value) { };
+ private static native short nio_get_Short(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(FloatBufferImpl b, int index, int limit, short value);
public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
FloatBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(FloatBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(FloatBufferImpl b, int index, int limit) { return 0;};
- private static void nio_put_Int(FloatBufferImpl b, int index, int limit, int value) { };
+ private static native int nio_get_Int(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(FloatBufferImpl b, int index, int limit, int value);
public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
FloatBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(FloatBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(FloatBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(FloatBufferImpl b, int index, int limit, long value) { };
+ private static native long nio_get_Long(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(FloatBufferImpl b, int index, int limit, long value);
public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
FloatBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(FloatBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(FloatBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(FloatBufferImpl b, int index, int limit, float value) { };
+ private static native float nio_get_Float(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(FloatBufferImpl b, int index, int limit, float value);
public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
FloatBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(FloatBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(FloatBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(FloatBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(FloatBufferImpl b, int index, int limit, double value) { };
+ private static native double nio_get_Double(FloatBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(FloatBufferImpl b, int index, int limit, double value);
public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+ private static native float[] nio_cast(byte[]copy);
+ private static native float[] nio_cast(char[]copy);
+ private static native float[] nio_cast(short[]copy);
+ private static native float[] nio_cast(long[]copy);
+ private static native float[] nio_cast(int[]copy);
+ private static native float[] nio_cast(float[]copy);
+ private static native float[] nio_cast(double[]copy);
+
public boolean isReadOnly()
{
return ro;
}
- public java.nio. FloatBuffer slice()
+ public FloatBuffer slice()
{
FloatBufferImpl A = new FloatBufferImpl(this);
A.array_offset = position();
return A;
}
- public java.nio. FloatBuffer duplicate()
+ public FloatBuffer duplicate()
{
return new FloatBufferImpl(this);
}
- public java.nio. FloatBuffer asReadOnlyBuffer()
+ public FloatBuffer asReadOnlyBuffer()
{
FloatBufferImpl a = new FloatBufferImpl(this);
a.ro = true;
return a;
}
- public java.nio. FloatBuffer compact()
+ public FloatBuffer compact()
{
return this;
}
@@ -191,7 +169,7 @@
return e;
}
- final public java.nio. FloatBuffer put(float b)
+ final public FloatBuffer put(float b)
{
backing_buffer[position()] = b;
position(position()+1);
@@ -203,16 +181,16 @@
return backing_buffer[index];
}
- final public java.nio. FloatBuffer put(int index, float b)
+ final public FloatBuffer put(int index, float b)
{
backing_buffer[index] = b;
return this;
}
- final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public java.nio. FloatBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public java.nio. FloatBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
- final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public java.nio. FloatBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public java.nio. FloatBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
- final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public java.nio. FloatBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public java.nio. FloatBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
- final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public java.nio. FloatBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public java.nio. FloatBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
- final public float getFloat() { return get(); } final public java.nio. FloatBuffer putFloat(float value) { return put(value); } final public float getFloat(int index) { return get(index); } final public java.nio. FloatBuffer putFloat(int index, float value) { return put(index, value); };
- final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. FloatBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. FloatBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public FloatBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public FloatBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public FloatBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public FloatBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public FloatBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public FloatBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public FloatBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public FloatBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { return get(); } final public FloatBuffer putFloat(float value) { return put(value); } final public float getFloat(int index) { return get(index); } final public FloatBuffer putFloat(int index, float value) { return put(index, value); };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public FloatBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public FloatBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
}
Index: gnu/java/nio/IntBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/IntBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 IntBufferImpl.java
--- gnu/java/nio/IntBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/IntBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -37,7 +37,13 @@
package gnu.java.nio;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
public final class IntBufferImpl extends IntBuffer
{
@@ -48,24 +54,24 @@
{
this.backing_buffer = new int[cap];
this.cap = cap;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public IntBufferImpl(int[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public IntBufferImpl(IntBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position(copy.position());
limit(copy.limit());
+ position(copy.position());
}
void inc_pos(int a)
@@ -73,96 +79,74 @@
position(position() + a);
}
-// private static native int[] nio_cast(byte[]copy);
-// private static native int[] nio_cast(char[]copy);
-// private static native int[] nio_cast(short[]copy);
-// private static native int[] nio_cast(long[]copy);
-// private static native int[] nio_cast(int[]copy);
-// private static native int[] nio_cast(float[]copy);
-// private static native int[] nio_cast(double[]copy);
-
- private static int[] nio_cast(byte[]copy) { return null; };
- private static int[] nio_cast(char[]copy) { return null; };
- private static int[] nio_cast(short[]copy) { return null; };
- private static int[] nio_cast(long[]copy) { return null; };
- private static int[] nio_cast(int[]copy) { return null; };
- private static int[] nio_cast(float[]copy) { return null; };
- private static int[] nio_cast(double[]copy) { return null; };
-
IntBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(IntBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(IntBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(IntBufferImpl b, int index, int limit, byte value) { };
- public java.nio. ByteBuffer asByteBuffer() { gnu.java.nio. ByteBufferImpl res = new gnu.java.nio. ByteBufferImpl(backing_buffer); res.limit((limit()*1)/4); return res; }
+ private static native byte nio_get_Byte(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(IntBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/4); return res; }
IntBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(IntBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(IntBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(IntBufferImpl b, int index, int limit, char value) { };
- public java.nio. CharBuffer asCharBuffer() { gnu.java.nio. CharBufferImpl res = new gnu.java.nio. CharBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+ private static native char nio_get_Char(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(IntBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
IntBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(IntBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(IntBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(IntBufferImpl b, int index, int limit, short value) { };
- public java.nio. ShortBuffer asShortBuffer() { gnu.java.nio. ShortBufferImpl res = new gnu.java.nio. ShortBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
+ private static native short nio_get_Short(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(IntBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/4); return res; }
IntBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(IntBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(IntBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(IntBufferImpl b, int index, int limit, int value) { };
- public java.nio. IntBuffer asIntBuffer() { gnu.java.nio. IntBufferImpl res = new gnu.java.nio. IntBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+ private static native int nio_get_Int(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(IntBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
IntBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(IntBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(IntBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(IntBufferImpl b, int index, int limit, long value) { };
- public java.nio. LongBuffer asLongBuffer() { gnu.java.nio. LongBufferImpl res = new gnu.java.nio. LongBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+ private static native long nio_get_Long(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(IntBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
IntBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(IntBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(IntBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(IntBufferImpl b, int index, int limit, float value) { };
- public java.nio. FloatBuffer asFloatBuffer() { gnu.java.nio. FloatBufferImpl res = new gnu.java.nio. FloatBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
+ private static native float nio_get_Float(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(IntBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/4); return res; }
IntBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(IntBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(IntBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(IntBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(IntBufferImpl b, int index, int limit, double value) { };
- public java.nio. DoubleBuffer asDoubleBuffer() { gnu.java.nio. DoubleBufferImpl res = new gnu.java.nio. DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+ private static native double nio_get_Double(IntBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(IntBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/4); return res; }
+
+ private static native int[] nio_cast(byte[]copy);
+ private static native int[] nio_cast(char[]copy);
+ private static native int[] nio_cast(short[]copy);
+ private static native int[] nio_cast(long[]copy);
+ private static native int[] nio_cast(int[]copy);
+ private static native int[] nio_cast(float[]copy);
+ private static native int[] nio_cast(double[]copy);
public boolean isReadOnly()
{
return ro;
}
- public java.nio. IntBuffer slice()
+ public IntBuffer slice()
{
IntBufferImpl A = new IntBufferImpl(this);
A.array_offset = position();
return A;
}
- public java.nio. IntBuffer duplicate()
+ public IntBuffer duplicate()
{
return new IntBufferImpl(this);
}
- public java.nio. IntBuffer asReadOnlyBuffer()
+ public IntBuffer asReadOnlyBuffer()
{
IntBufferImpl a = new IntBufferImpl(this);
a.ro = true;
return a;
}
- public java.nio. IntBuffer compact()
+ public IntBuffer compact()
{
return this;
}
@@ -179,7 +163,7 @@
return e;
}
- final public java.nio. IntBuffer put(int b)
+ final public IntBuffer put(int b)
{
backing_buffer[position()] = b;
position(position()+1);
@@ -191,16 +175,16 @@
return backing_buffer[index];
}
- final public java.nio. IntBuffer put(int index, int b)
+ final public IntBuffer put(int index, int b)
{
backing_buffer[index] = b;
return this;
}
- final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public java.nio. IntBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public java.nio. IntBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
- final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public java.nio. IntBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public java.nio. IntBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
- final public int getInt() { return get(); } final public java.nio. IntBuffer putInt(int value) { return put(value); } final public int getInt(int index) { return get(index); } final public java.nio. IntBuffer putInt(int index, int value) { return put(index, value); };
- final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public java.nio. IntBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public java.nio. IntBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
- final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public java.nio. IntBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public java.nio. IntBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
- final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. IntBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. IntBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public IntBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public IntBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public IntBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public IntBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { return get(); } final public IntBuffer putInt(int value) { return put(value); } final public int getInt(int index) { return get(index); } final public IntBuffer putInt(int index, int value) { return put(index, value); };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public IntBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public IntBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public IntBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public IntBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public IntBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public IntBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
}
Index: gnu/java/nio/LongBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/LongBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 LongBufferImpl.java
--- gnu/java/nio/LongBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/LongBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -54,24 +54,24 @@
{
this.backing_buffer = new long[cap];
this.cap = cap ;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public LongBufferImpl(long[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public LongBufferImpl(LongBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position(copy.position());
limit(copy.limit());
+ position(copy.position());
}
void inc_pos(int a)
@@ -79,96 +79,74 @@
position(position() + a);
}
-// private static native long[] nio_cast(byte[]copy);
-// private static native long[] nio_cast(char[]copy);
-// private static native long[] nio_cast(short[]copy);
-// private static native long[] nio_cast(long[]copy);
-// private static native long[] nio_cast(int[]copy);
-// private static native long[] nio_cast(float[]copy);
-// private static native long[] nio_cast(double[]copy);
-
- private static long[] nio_cast(byte[]copy) { return null; };
- private static long[] nio_cast(char[]copy) { return null; };
- private static long[] nio_cast(short[]copy) { return null; };
- private static long[] nio_cast(long[]copy) { return null; };
- private static long[] nio_cast(int[]copy) { return null; };
- private static long[] nio_cast(float[]copy) { return null; };
- private static long[] nio_cast(double[]copy) { return null; };
-
LongBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(LongBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(LongBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(LongBufferImpl b, int index, int limit, byte value) { };
- public java.nio. ByteBuffer asByteBuffer() { gnu.java.nio. ByteBufferImpl res = new gnu.java.nio. ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; }
+ private static native byte nio_get_Byte(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(LongBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; }
LongBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(LongBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(LongBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(LongBufferImpl b, int index, int limit, char value) { };
- public java.nio. CharBuffer asCharBuffer() { gnu.java.nio. CharBufferImpl res = new gnu.java.nio. CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+ private static native char nio_get_Char(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(LongBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
LongBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(LongBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(LongBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(LongBufferImpl b, int index, int limit, short value) { };
- public java.nio. ShortBuffer asShortBuffer() { gnu.java.nio. ShortBufferImpl res = new gnu.java.nio. ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
+ private static native short nio_get_Short(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(LongBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; }
LongBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(LongBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(LongBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(LongBufferImpl b, int index, int limit, int value) { };
- public java.nio. IntBuffer asIntBuffer() { gnu.java.nio. IntBufferImpl res = new gnu.java.nio. IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+ private static native int nio_get_Int(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(LongBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
LongBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(LongBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(LongBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(LongBufferImpl b, int index, int limit, long value) { };
- public java.nio. LongBuffer asLongBuffer() { gnu.java.nio. LongBufferImpl res = new gnu.java.nio. LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+ private static native long nio_get_Long(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(LongBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
LongBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(LongBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(LongBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(LongBufferImpl b, int index, int limit, float value) { };
- public java.nio. FloatBuffer asFloatBuffer() { gnu.java.nio. FloatBufferImpl res = new gnu.java.nio. FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
+ private static native float nio_get_Float(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(LongBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; }
LongBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(LongBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(LongBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(LongBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(LongBufferImpl b, int index, int limit, double value) { };
- public java.nio. DoubleBuffer asDoubleBuffer() { gnu.java.nio. DoubleBufferImpl res = new gnu.java.nio. DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+ private static native double nio_get_Double(LongBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(LongBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; }
+
+ private static native long[] nio_cast(byte[]copy);
+ private static native long[] nio_cast(char[]copy);
+ private static native long[] nio_cast(short[]copy);
+ private static native long[] nio_cast(long[]copy);
+ private static native long[] nio_cast(int[]copy);
+ private static native long[] nio_cast(float[]copy);
+ private static native long[] nio_cast(double[]copy);
public boolean isReadOnly()
{
return ro;
}
- public java.nio. LongBuffer slice()
+ public LongBuffer slice()
{
LongBufferImpl A = new LongBufferImpl(this);
A.array_offset = position();
return A;
}
- public java.nio. LongBuffer duplicate()
+ public LongBuffer duplicate()
{
return new LongBufferImpl(this);
}
- public java.nio. LongBuffer asReadOnlyBuffer()
+ public LongBuffer asReadOnlyBuffer()
{
LongBufferImpl a = new LongBufferImpl(this);
a.ro = true;
return a;
}
- public java.nio. LongBuffer compact()
+ public LongBuffer compact()
{
return this;
}
@@ -185,7 +163,7 @@
return e;
}
- final public java.nio. LongBuffer put(long b)
+ final public LongBuffer put(long b)
{
backing_buffer[position()] = b;
position(position()+1);
@@ -197,16 +175,16 @@
return backing_buffer[index];
}
- final public java.nio. LongBuffer put(int index, long b)
+ final public LongBuffer put(int index, long b)
{
backing_buffer[index] = b;
return this;
}
- final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public java.nio. LongBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public java.nio. LongBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
- final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public java.nio. LongBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public java.nio. LongBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
- final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public java.nio. LongBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public java.nio. LongBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
- final public long getLong() { return get(); } final public java.nio. LongBuffer putLong(long value) { return put(value); } final public long getLong(int index) { return get(index); } final public java.nio. LongBuffer putLong(int index, long value) { return put(index, value); };
- final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public java.nio. LongBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public java.nio. LongBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
- final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. LongBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. LongBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public LongBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public LongBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { short a = nio_get_Short(this, position(), limit()); inc_pos(2); return a; } final public LongBuffer putShort(short value) { nio_put_Short(this, position(), limit(), value); inc_pos(2); return this; } final public short getShort(int index) { short a = nio_get_Short(this, index, limit()); return a; } final public LongBuffer putShort(int index, short value) { nio_put_Short(this, index, limit(), value); return this; };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public LongBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public LongBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { return get(); } final public LongBuffer putLong(long value) { return put(value); } final public long getLong(int index) { return get(index); } final public LongBuffer putLong(int index, long value) { return put(index, value); };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public LongBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public LongBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public LongBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public LongBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
}
Index: gnu/java/nio/ShortBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/ShortBufferImpl.java,v
retrieving revision 1.1
diff -b -u -r1.1 ShortBufferImpl.java
--- gnu/java/nio/ShortBufferImpl.java 18 Nov 2002 13:56:58 -0000 1.1
+++ gnu/java/nio/ShortBufferImpl.java 29 Nov 2002 07:46:03 -0000
@@ -54,24 +54,24 @@
{
this.backing_buffer = new short[cap];
this.cap = cap ;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public ShortBufferImpl(short[] array, int off, int lim)
{
this.backing_buffer = array;
this.cap = array.length;
- this.position(off);
this.limit(lim);
+ this.position(off);
}
public ShortBufferImpl(ShortBufferImpl copy)
{
backing_buffer = copy.backing_buffer;
ro = copy.ro;
- position(copy.position());
limit(copy.limit());
+ position(copy.position());
}
void inc_pos(int a)
@@ -79,70 +79,48 @@
position(position() + a);
}
-// private static native short[] nio_cast(byte[]copy);
-// private static native short[] nio_cast(char[]copy);
-// private static native short[] nio_cast(short[]copy);
-// private static native short[] nio_cast(long[]copy);
-// private static native short[] nio_cast(int[]copy);
-// private static native short[] nio_cast(float[]copy);
-// private static native short[] nio_cast(double[]copy);
-
- private static short[] nio_cast(byte[]copy) { return null; };
- private static short[] nio_cast(char[]copy) { return null; };
- private static short[] nio_cast(short[]copy) { return null; };
- private static short[] nio_cast(long[]copy) { return null; };
- private static short[] nio_cast(int[]copy) { return null; };
- private static short[] nio_cast(float[]copy) { return null; };
- private static short[] nio_cast(double[]copy) { return null; };
-
ShortBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native byte nio_get_Byte(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Byte(ShortBufferImpl b, int index, int limit, byte value);
- private static byte nio_get_Byte(ShortBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Byte(ShortBufferImpl b, int index, int limit, byte value) { };
- public java.nio. ByteBuffer asByteBuffer() { gnu.java.nio. ByteBufferImpl res = new gnu.java.nio. ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
+ private static native byte nio_get_Byte(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Byte(ShortBufferImpl b, int index, int limit, byte value);
+ public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/2); return res; }
ShortBufferImpl(char[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native char nio_get_Char(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Char(ShortBufferImpl b, int index, int limit, char value);
- private static char nio_get_Char(ShortBufferImpl b, int index, int limit) { return ' '; };
- private static void nio_put_Char(ShortBufferImpl b, int index, int limit, char value) { };
- public java.nio. CharBuffer asCharBuffer() { gnu.java.nio. CharBufferImpl res = new gnu.java.nio. CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+ private static native char nio_get_Char(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Char(ShortBufferImpl b, int index, int limit, char value);
+ public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
ShortBufferImpl(short[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native short nio_get_Short(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Short(ShortBufferImpl b, int index, int limit, short value);
- private static short nio_get_Short(ShortBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Short(ShortBufferImpl b, int index, int limit, short value) { };
- public java.nio. ShortBuffer asShortBuffer() { gnu.java.nio. ShortBufferImpl res = new gnu.java.nio. ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
+ private static native short nio_get_Short(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Short(ShortBufferImpl b, int index, int limit, short value);
+ public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/2); return res; }
ShortBufferImpl(int[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native int nio_get_Int(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Int(ShortBufferImpl b, int index, int limit, int value);
- private static int nio_get_Int(ShortBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Int(ShortBufferImpl b, int index, int limit, int value) { };
- public java.nio. IntBuffer asIntBuffer() { gnu.java.nio. IntBufferImpl res = new gnu.java.nio. IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+ private static native int nio_get_Int(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Int(ShortBufferImpl b, int index, int limit, int value);
+ public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
ShortBufferImpl(long[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native long nio_get_Long(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Long(ShortBufferImpl b, int index, int limit, long value);
- private static long nio_get_Long(ShortBufferImpl b, int index, int limit) { return 0; };
- private static void nio_put_Long(ShortBufferImpl b, int index, int limit, long value) { };
- public java.nio. LongBuffer asLongBuffer() { gnu.java.nio. LongBufferImpl res = new gnu.java.nio. LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+ private static native long nio_get_Long(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Long(ShortBufferImpl b, int index, int limit, long value);
+ public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
ShortBufferImpl(float[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native float nio_get_Float(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Float(ShortBufferImpl b, int index, int limit, float value);
- private static float nio_get_Float(ShortBufferImpl b, int index, int limit) { return 0.0f; };
- private static void nio_put_Float(ShortBufferImpl b, int index, int limit, float value) { };
- public java.nio. FloatBuffer asFloatBuffer() { gnu.java.nio. FloatBufferImpl res = new gnu.java.nio. FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
+ private static native float nio_get_Float(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Float(ShortBufferImpl b, int index, int limit, float value);
+ public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/2); return res; }
ShortBufferImpl(double[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; }
-// private static native double nio_get_Double(ShortBufferImpl b, int index, int limit);
-// private static native void nio_put_Double(ShortBufferImpl b, int index, int limit, double value);
- private static double nio_get_Double(ShortBufferImpl b, int index, int limit) { return 0.0d; };
- private static void nio_put_Double(ShortBufferImpl b, int index, int limit, double value) { };
- public java.nio. DoubleBuffer asDoubleBuffer() { gnu.java.nio. DoubleBufferImpl res = new gnu.java.nio. DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+ private static native double nio_get_Double(ShortBufferImpl b, int index, int limit);
+ private static native void nio_put_Double(ShortBufferImpl b, int index, int limit, double value);
+ public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/2); return res; }
+
+ private static native short[] nio_cast(byte[]copy);
+ private static native short[] nio_cast(char[]copy);
+ private static native short[] nio_cast(short[]copy);
+ private static native short[] nio_cast(long[]copy);
+ private static native short[] nio_cast(int[]copy);
+ private static native short[] nio_cast(float[]copy);
+ private static native short[] nio_cast(double[]copy);
public boolean isReadOnly()
{
@@ -203,10 +181,10 @@
return this;
}
- final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public java.nio. ShortBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public java.nio. ShortBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
- final public short getShort() { return get(); } final public java.nio. ShortBuffer putShort(short value) { return put(value); } final public short getShort(int index) { return get(index); } final public java.nio. ShortBuffer putShort(int index, short value) { return put(index, value); };
- final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public java.nio. ShortBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public java.nio. ShortBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
- final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public java.nio. ShortBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public java.nio. ShortBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
- final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public java.nio. ShortBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public java.nio. ShortBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
- final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public java.nio. ShortBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public java.nio. ShortBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
+ final public char getChar() { char a = nio_get_Char(this, position(), limit()); inc_pos(2); return a; } final public ShortBuffer putChar(char value) { nio_put_Char(this, position(), limit(), value); inc_pos(2); return this; } final public char getChar(int index) { char a = nio_get_Char(this, index, limit()); return a; } final public ShortBuffer putChar(int index, char value) { nio_put_Char(this, index, limit(), value); return this; };
+ final public short getShort() { return get(); } final public ShortBuffer putShort(short value) { return put(value); } final public short getShort(int index) { return get(index); } final public ShortBuffer putShort(int index, short value) { return put(index, value); };
+ final public int getInt() { int a = nio_get_Int(this, position(), limit()); inc_pos(4); return a; } final public ShortBuffer putInt(int value) { nio_put_Int(this, position(), limit(), value); inc_pos(4); return this; } final public int getInt(int index) { int a = nio_get_Int(this, index, limit()); return a; } final public ShortBuffer putInt(int index, int value) { nio_put_Int(this, index, limit(), value); return this; };
+ final public long getLong() { long a = nio_get_Long(this, position(), limit()); inc_pos(8); return a; } final public ShortBuffer putLong(long value) { nio_put_Long(this, position(), limit(), value); inc_pos(8); return this; } final public long getLong(int index) { long a = nio_get_Long(this, index, limit()); return a; } final public ShortBuffer putLong(int index, long value) { nio_put_Long(this, index, limit(), value); return this; };
+ final public float getFloat() { float a = nio_get_Float(this, position(), limit()); inc_pos(4); return a; } final public ShortBuffer putFloat(float value) { nio_put_Float(this, position(), limit(), value); inc_pos(4); return this; } final public float getFloat(int index) { float a = nio_get_Float(this, index, limit()); return a; } final public ShortBuffer putFloat(int index, float value) { nio_put_Float(this, index, limit(), value); return this; };
+ final public double getDouble() { double a = nio_get_Double(this, position(), limit()); inc_pos(8); return a; } final public ShortBuffer putDouble(double value) { nio_put_Double(this, position(), limit(), value); inc_pos(8); return this; } final public double getDouble(int index) { double a = nio_get_Double(this, index, limit()); return a; } final public ShortBuffer putDouble(int index, double value) { nio_put_Double(this, index, limit(), value); return this; };
}