From ac7edc01e80616a8befedf7610d13ce28fb4fe24 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Fri, 29 Nov 2002 07:50:46 +0000 Subject: 2002-11-29 Michael Koch * 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 --- libjava/gnu/java/nio/DoubleBufferImpl.java | 72 +++++++++++------------------- 1 file changed, 25 insertions(+), 47 deletions(-) (limited to 'libjava/gnu/java/nio/DoubleBufferImpl.java') diff --git a/libjava/gnu/java/nio/DoubleBufferImpl.java b/libjava/gnu/java/nio/DoubleBufferImpl.java index 40628679ef0..de0e6717fd0 100644 --- a/libjava/gnu/java/nio/DoubleBufferImpl.java +++ b/libjava/gnu/java/nio/DoubleBufferImpl.java @@ -54,24 +54,24 @@ public final class DoubleBufferImpl extends DoubleBuffer { 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,71 +79,49 @@ public final class DoubleBufferImpl extends DoubleBuffer 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() { return ro; -- cgit v1.2.3