Commit ac7edc01 by Michael Koch Committed by Michael Koch

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.

From-SVN: r59624
parent 3f7211f1
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> 2002-11-27 Julian Dolby <dolby@us.ibm.com>
* java/util/Locale.java (toString): Improve efficiency if country * java/util/Locale.java (toString): Improve efficiency if country
......
...@@ -54,24 +54,24 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -54,24 +54,24 @@ public final class ByteBufferImpl extends ByteBuffer
public ByteBufferImpl (int cap, int off, int lim) public ByteBufferImpl (int cap, int off, int lim)
{ {
this.cap = cap; this.cap = cap;
position (off);
limit (lim); limit (lim);
position (off);
this.backing_buffer = new byte[cap]; this.backing_buffer = new byte[cap];
} }
public ByteBufferImpl (byte[] array, int off, int lim) public ByteBufferImpl (byte[] array, int off, int lim)
{ {
this.cap = array.length; this.cap = array.length;
position (off);
limit (lim); limit (lim);
position (off);
this.backing_buffer = array; this.backing_buffer = array;
} }
public ByteBufferImpl (ByteBufferImpl copy) public ByteBufferImpl (ByteBufferImpl copy)
{ {
this.cap = copy.capacity (); this.cap = copy.capacity ();
position (copy.position ());
limit (copy.limit ()); limit (copy.limit ());
position (copy.position ());
ro = copy.ro; ro = copy.ro;
backing_buffer = copy.backing_buffer; backing_buffer = copy.backing_buffer;
} }
...@@ -81,71 +81,50 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -81,71 +81,50 @@ public final class ByteBufferImpl extends ByteBuffer
position (position () + toAdd); position (position () + toAdd);
} }
// private static native byte[] nio_cast(byte[]copy); private static native byte[] nio_cast(byte[]copy);
// private static native byte[] nio_cast(char[]copy); private static native byte[] nio_cast(char[]copy);
// private static native byte[] nio_cast(short[]copy); private static native byte[] nio_cast(short[]copy);
// private static native byte[] nio_cast(long[]copy); private static native byte[] nio_cast(long[]copy);
// private static native byte[] nio_cast(int[]copy); private static native byte[] nio_cast(int[]copy);
// private static native byte[] nio_cast(float[]copy); private static native byte[] nio_cast(float[]copy);
// private static native byte[] nio_cast(double[]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; };
ByteBufferImpl(byte[] copy) { this.backing_buffer = copy != null ? nio_cast(copy) : null; } 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 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 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) { };
public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/1); return res; } 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; } 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 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 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) { };
public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; } 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; } 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 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 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) { };
public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/1); return res; } 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; } 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 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 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) { };
public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; } 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; } 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 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 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) { };
public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; } 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; } 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 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 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) { };
public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/1); return res; } 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; } 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 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 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) { };
public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; } public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/1); return res; }
public boolean isReadOnly() public boolean isReadOnly()
{ {
return ro; return ro;
...@@ -157,19 +136,19 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -157,19 +136,19 @@ public final class ByteBufferImpl extends ByteBuffer
A.array_offset = position(); A.array_offset = position();
return A; return A;
} }
public ByteBuffer duplicate() public ByteBuffer duplicate()
{ {
return new ByteBufferImpl(this); return new ByteBufferImpl(this);
} }
public ByteBuffer asReadOnlyBuffer() public ByteBuffer asReadOnlyBuffer()
{ {
ByteBufferImpl a = new ByteBufferImpl(this); ByteBufferImpl a = new ByteBufferImpl(this);
a.ro = true; a.ro = true;
return a; return a;
} }
public ByteBuffer compact() public ByteBuffer compact()
{ {
return this; return this;
...@@ -179,7 +158,7 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -179,7 +158,7 @@ public final class ByteBufferImpl extends ByteBuffer
{ {
return backing_buffer != null; return backing_buffer != null;
} }
final public byte get() final public byte get()
{ {
byte e = backing_buffer[position()]; byte e = backing_buffer[position()];
...@@ -198,7 +177,7 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -198,7 +177,7 @@ public final class ByteBufferImpl extends ByteBuffer
{ {
return backing_buffer[index]; return backing_buffer[index];
} }
final public ByteBuffer put(int index, byte b) final public ByteBuffer put(int index, byte b)
{ {
backing_buffer[index] = b; backing_buffer[index] = b;
......
...@@ -54,24 +54,24 @@ public final class DoubleBufferImpl extends DoubleBuffer ...@@ -54,24 +54,24 @@ public final class DoubleBufferImpl extends DoubleBuffer
{ {
this.backing_buffer = new double[cap]; this.backing_buffer = new double[cap];
this.cap = cap; this.cap = cap;
this.position(off);
this.limit(lim); this.limit(lim);
this.position(off);
} }
public DoubleBufferImpl(double[] array, int off, int lim) public DoubleBufferImpl(double[] array, int off, int lim)
{ {
this.backing_buffer = array; this.backing_buffer = array;
this.cap = array.length; this.cap = array.length;
this.position(off);
this.limit(lim); this.limit(lim);
this.position(off);
} }
public DoubleBufferImpl(DoubleBufferImpl copy) public DoubleBufferImpl(DoubleBufferImpl copy)
{ {
backing_buffer = copy.backing_buffer; backing_buffer = copy.backing_buffer;
ro = copy.ro; ro = copy.ro;
position(copy.position());
limit(copy.limit()); limit(copy.limit());
position(copy.position());
} }
void inc_pos(int a) void inc_pos(int a)
...@@ -79,71 +79,49 @@ public final class DoubleBufferImpl extends DoubleBuffer ...@@ -79,71 +79,49 @@ public final class DoubleBufferImpl extends DoubleBuffer
position(position() + a); 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; } 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 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 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) { };
public ByteBuffer asByteBuffer() { ByteBufferImpl res = new ByteBufferImpl(backing_buffer); res.limit((limit()*1)/8); return res; } 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; } 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 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 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) { };
public CharBuffer asCharBuffer() { CharBufferImpl res = new CharBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; } 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; } 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 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 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) { };
public ShortBuffer asShortBuffer() { ShortBufferImpl res = new ShortBufferImpl(backing_buffer); res.limit((limit()*2)/8); return res; } 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; } 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 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 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) { };
public IntBuffer asIntBuffer() { IntBufferImpl res = new IntBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; } 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; } 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 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 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) { };
public LongBuffer asLongBuffer() { LongBufferImpl res = new LongBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; } 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; } 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 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 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) { };
public FloatBuffer asFloatBuffer() { FloatBufferImpl res = new FloatBufferImpl(backing_buffer); res.limit((limit()*4)/8); return res; } 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; } 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 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 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) { };
public DoubleBuffer asDoubleBuffer() { DoubleBufferImpl res = new DoubleBufferImpl(backing_buffer); res.limit((limit()*8)/8); return res; } 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() public boolean isReadOnly()
{ {
return ro; return ro;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment