diff options
Diffstat (limited to 'java/nio')
-rw-r--r-- | java/nio/Buffer.java | 3 | ||||
-rw-r--r-- | java/nio/ByteBuffer.java | 3 | ||||
-rw-r--r-- | java/nio/ByteBufferImpl.java | 12 | ||||
-rw-r--r-- | java/nio/CharBuffer.java | 9 | ||||
-rw-r--r-- | java/nio/CharViewBufferImpl.java | 6 | ||||
-rw-r--r-- | java/nio/DirectByteBufferImpl.java | 93 | ||||
-rw-r--r-- | java/nio/DoubleBuffer.java | 3 | ||||
-rw-r--r-- | java/nio/DoubleBufferImpl.java | 12 | ||||
-rw-r--r-- | java/nio/FloatBuffer.java | 3 | ||||
-rw-r--r-- | java/nio/FloatBufferImpl.java | 3 | ||||
-rw-r--r-- | java/nio/IntBuffer.java | 6 | ||||
-rw-r--r-- | java/nio/LongBuffer.java | 3 | ||||
-rw-r--r-- | java/nio/LongBufferImpl.java | 12 | ||||
-rw-r--r-- | java/nio/MappedByteBuffer.java | 3 | ||||
-rw-r--r-- | java/nio/ShortBuffer.java | 4 | ||||
-rw-r--r-- | java/nio/ShortBufferImpl.java | 12 | ||||
-rw-r--r-- | java/nio/ShortViewBufferImpl.java | 6 |
17 files changed, 119 insertions, 74 deletions
diff --git a/java/nio/Buffer.java b/java/nio/Buffer.java index fce60c88c..5dc670255 100644 --- a/java/nio/Buffer.java +++ b/java/nio/Buffer.java @@ -56,7 +56,8 @@ public abstract class Buffer * * Should be package private. */ - Buffer (int capacity, int limit, int position, int mark, Pointer address) + Buffer (int capacity, int limit, int position, int mark, + Pointer address) { this.address = address; diff --git a/java/nio/ByteBuffer.java b/java/nio/ByteBuffer.java index 592b262c2..2296e7174 100644 --- a/java/nio/ByteBuffer.java +++ b/java/nio/ByteBuffer.java @@ -50,7 +50,8 @@ public abstract class ByteBuffer extends Buffer final byte[] backing_buffer; final int array_offset; - ByteBuffer (int capacity, int limit, int position, int mark, Pointer address, byte[] backing_buffer, int array_offset) + ByteBuffer (int capacity, int limit, int position, int mark, + Pointer address, byte[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; diff --git a/java/nio/ByteBufferImpl.java b/java/nio/ByteBufferImpl.java index 76c094005..6a1ac4681 100644 --- a/java/nio/ByteBufferImpl.java +++ b/java/nio/ByteBufferImpl.java @@ -45,7 +45,8 @@ final class ByteBufferImpl extends ByteBuffer { private final boolean readOnly; - ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly) + ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit, + int position, int mark, boolean readOnly) { super (capacity, limit, position, mark, null, buffer, offset); this.readOnly = readOnly; @@ -88,17 +89,20 @@ final class ByteBufferImpl extends ByteBuffer public ByteBuffer slice () { - return new ByteBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ()); + return new ByteBufferImpl (backing_buffer, array_offset + position (), + remaining (), remaining (), 0, -1, isReadOnly ()); } public ByteBuffer duplicate () { - return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ()); + return new ByteBufferImpl (backing_buffer, array_offset, capacity (), + limit (), position (), mark, isReadOnly ()); } public ByteBuffer asReadOnlyBuffer () { - return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true); + return new ByteBufferImpl (backing_buffer, array_offset, capacity (), + limit (), position (), mark, true); } void shiftDown (int dst_offset, int src_offset, int count) diff --git a/java/nio/CharBuffer.java b/java/nio/CharBuffer.java index 8b0c36cd1..faee773bd 100644 --- a/java/nio/CharBuffer.java +++ b/java/nio/CharBuffer.java @@ -38,9 +38,10 @@ exception statement from your version. */ package java.nio; -import java.io.IOException; import gnu.classpath.Pointer; +import java.io.IOException; + /** * @since 1.4 */ @@ -50,7 +51,8 @@ public abstract class CharBuffer extends Buffer final int array_offset; final char[] backing_buffer; - CharBuffer (int capacity, int limit, int position, int mark, Pointer address, char[] backing_buffer, int array_offset) + CharBuffer (int capacity, int limit, int position, int mark, + Pointer address, char[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; @@ -80,7 +82,8 @@ public abstract class CharBuffer extends Buffer */ public static final CharBuffer wrap(char[] array, int offset, int length) { - return new CharBufferImpl(array, 0, array.length, offset + length, offset, -1, false); + return new CharBufferImpl(array, 0, array.length, offset + length, offset, + -1, false); } /** diff --git a/java/nio/CharViewBufferImpl.java b/java/nio/CharViewBufferImpl.java index bb562de62..98a27a6e6 100644 --- a/java/nio/CharViewBufferImpl.java +++ b/java/nio/CharViewBufferImpl.java @@ -49,7 +49,8 @@ class CharViewBufferImpl extends CharBuffer CharViewBufferImpl (ByteBuffer bb, int capacity) { super (capacity, capacity, 0, -1, bb.isDirect() ? - VMDirectByteBuffer.adjustAddress(bb.address, bb.position()) : null, null, 0); + VMDirectByteBuffer.adjustAddress(bb.address, bb.position()) : null, + null, 0); this.bb = bb; this.offset = bb.position(); this.readOnly = bb.isReadOnly(); @@ -61,7 +62,8 @@ class CharViewBufferImpl extends CharBuffer boolean readOnly, ByteOrder endian) { super (capacity, limit, position, mark, bb.isDirect() ? - VMDirectByteBuffer.adjustAddress(bb.address, offset) : null, null, 0); + VMDirectByteBuffer.adjustAddress(bb.address, offset) : null, + null, 0); this.bb = bb; this.offset = offset; this.readOnly = readOnly; diff --git a/java/nio/DirectByteBufferImpl.java b/java/nio/DirectByteBufferImpl.java index 60df3611a..939718e9c 100644 --- a/java/nio/DirectByteBufferImpl.java +++ b/java/nio/DirectByteBufferImpl.java @@ -1,4 +1,4 @@ -/* DirectByteBufferImpl.java -- +/* DirectByteBufferImpl.java -- Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -60,8 +60,8 @@ abstract class DirectByteBufferImpl extends ByteBuffer static final class ReadOnly extends DirectByteBufferImpl { ReadOnly(Object owner, Pointer address, - int capacity, int limit, - int position) + int capacity, int limit, + int position) { super(owner, address, capacity, limit, position); } @@ -89,9 +89,14 @@ abstract class DirectByteBufferImpl extends ByteBuffer super(capacity); } + ReadWrite(Pointer address, int capacity) + { + super(address, capacity); + } + ReadWrite(Object owner, Pointer address, - int capacity, int limit, - int position) + int capacity, int limit, + int position) { super(owner, address, capacity, limit, position); } @@ -104,13 +109,20 @@ abstract class DirectByteBufferImpl extends ByteBuffer DirectByteBufferImpl(int capacity) { - super(capacity, capacity, 0, -1, VMDirectByteBuffer.allocate(capacity), null, 0); + super(capacity, capacity, 0, -1, + VMDirectByteBuffer.allocate(capacity), null, 0); this.owner = this; } + DirectByteBufferImpl(Pointer address, int capacity) + { + super(capacity, capacity, 0, -1, address, null, 0); + this.owner = null; + } + DirectByteBufferImpl(Object owner, Pointer address, - int capacity, int limit, - int position) + int capacity, int limit, + int position) { super(capacity, limit, position, -1, address, null, 0); this.owner = owner; @@ -118,7 +130,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer /** * Allocates a new direct byte buffer. - */ + */ public static ByteBuffer allocate(int capacity) { return new DirectByteBufferImpl.ReadWrite(capacity); @@ -129,7 +141,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer if (owner == this) VMDirectByteBuffer.free(address); } - + public byte get() { checkForUnderflow(); @@ -168,7 +180,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer position(pos + 1); return this; } - + public ByteBuffer put(int index, byte value) { checkIndex(index); @@ -176,24 +188,23 @@ abstract class DirectByteBufferImpl extends ByteBuffer VMDirectByteBuffer.put(address, index, value); return this; } - + public ByteBuffer put (byte[] src, int offset, int length) { checkArraySize (src.length, offset, length); checkForUnderflow (length); - int index = position (); VMDirectByteBuffer.put (address, index, src, offset, length); position (index + length); - + return this; } - + void shiftDown(int dst_offset, int src_offset, int count) { VMDirectByteBuffer.shiftDown(address, dst_offset, src_offset, count); } - + public ByteBuffer compact() { checkIfReadOnly(); @@ -201,15 +212,15 @@ abstract class DirectByteBufferImpl extends ByteBuffer int pos = position(); if (pos > 0) { - int count = remaining(); - VMDirectByteBuffer.shiftDown(address, 0, pos, count); - position(count); - limit(capacity()); + int count = remaining(); + VMDirectByteBuffer.shiftDown(address, 0, pos, count); + position(count); + limit(capacity()); } else { - position(limit()); - limit(capacity()); + position(limit()); + limit(capacity()); } return this; } @@ -244,9 +255,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer if (mark != pos) { - result.position(mark); - result.mark(); - result.position(pos); + result.position(mark); + result.mark(); + result.position(pos); } return result; } @@ -300,18 +311,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer { return ByteBufferHelper.getChar(this, order()); } - + public ByteBuffer putChar(char value) { ByteBufferHelper.putChar(this, value, order()); return this; } - + public char getChar(int index) { return ByteBufferHelper.getChar(this, index, order()); } - + public ByteBuffer putChar(int index, char value) { ByteBufferHelper.putChar(this, index, value, order()); @@ -322,18 +333,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer { return ByteBufferHelper.getShort(this, order()); } - + public ByteBuffer putShort(short value) { ByteBufferHelper.putShort(this, value, order()); return this; } - + public short getShort(int index) { return ByteBufferHelper.getShort(this, index, order()); } - + public ByteBuffer putShort(int index, short value) { ByteBufferHelper.putShort(this, index, value, order()); @@ -344,18 +355,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer { return ByteBufferHelper.getInt(this, order()); } - + public ByteBuffer putInt(int value) { ByteBufferHelper.putInt(this, value, order()); return this; } - + public int getInt(int index) { return ByteBufferHelper.getInt(this, index, order()); } - + public ByteBuffer putInt(int index, int value) { ByteBufferHelper.putInt(this, index, value, order()); @@ -366,18 +377,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer { return ByteBufferHelper.getLong(this, order()); } - + public ByteBuffer putLong(long value) { ByteBufferHelper.putLong(this, value, order()); return this; } - + public long getLong(int index) { return ByteBufferHelper.getLong(this, index, order()); } - + public ByteBuffer putLong(int index, long value) { ByteBufferHelper.putLong(this, index, value, order()); @@ -388,13 +399,13 @@ abstract class DirectByteBufferImpl extends ByteBuffer { return ByteBufferHelper.getFloat(this, order()); } - + public ByteBuffer putFloat(float value) { ByteBufferHelper.putFloat(this, value, order()); return this; } - + public float getFloat(int index) { return ByteBufferHelper.getFloat(this, index, order()); @@ -416,12 +427,12 @@ abstract class DirectByteBufferImpl extends ByteBuffer ByteBufferHelper.putDouble(this, value, order()); return this; } - + public double getDouble(int index) { return ByteBufferHelper.getDouble(this, index, order()); } - + public ByteBuffer putDouble(int index, double value) { ByteBufferHelper.putDouble(this, index, value, order()); diff --git a/java/nio/DoubleBuffer.java b/java/nio/DoubleBuffer.java index 231510f89..ffbf1ac3a 100644 --- a/java/nio/DoubleBuffer.java +++ b/java/nio/DoubleBuffer.java @@ -49,7 +49,8 @@ public abstract class DoubleBuffer extends Buffer final int array_offset; final double[] backing_buffer; - DoubleBuffer (int capacity, int limit, int position, int mark, Pointer address, double[] backing_buffer, int array_offset) + DoubleBuffer (int capacity, int limit, int position, int mark, + Pointer address, double[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; diff --git a/java/nio/DoubleBufferImpl.java b/java/nio/DoubleBufferImpl.java index 595ae18a8..bc292df64 100644 --- a/java/nio/DoubleBufferImpl.java +++ b/java/nio/DoubleBufferImpl.java @@ -50,7 +50,8 @@ final class DoubleBufferImpl extends DoubleBuffer this (new double [capacity], 0, capacity, capacity, 0, -1, false); } - DoubleBufferImpl (double[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly) + DoubleBufferImpl (double[] buffer, int offset, int capacity, int limit, + int position, int mark, boolean readOnly) { super (capacity, limit, position, mark, null, buffer, offset); this.readOnly = readOnly; @@ -63,17 +64,20 @@ final class DoubleBufferImpl extends DoubleBuffer public DoubleBuffer slice () { - return new DoubleBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ()); + return new DoubleBufferImpl (backing_buffer, array_offset + position (), + remaining (), remaining (), 0, -1, isReadOnly ()); } public DoubleBuffer duplicate () { - return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ()); + return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), + limit (), position (), mark, isReadOnly ()); } public DoubleBuffer asReadOnlyBuffer () { - return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true); + return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), + limit (), position (), mark, true); } public DoubleBuffer compact () diff --git a/java/nio/FloatBuffer.java b/java/nio/FloatBuffer.java index fc8df31ba..4eba2eaf7 100644 --- a/java/nio/FloatBuffer.java +++ b/java/nio/FloatBuffer.java @@ -49,7 +49,8 @@ public abstract class FloatBuffer extends Buffer final int array_offset; final float[] backing_buffer; - FloatBuffer (int capacity, int limit, int position, int mark, Pointer address, float[] backing_buffer, int array_offset) + FloatBuffer (int capacity, int limit, int position, int mark, + Pointer address, float[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; diff --git a/java/nio/FloatBufferImpl.java b/java/nio/FloatBufferImpl.java index 30c10cc40..5d0e7ca85 100644 --- a/java/nio/FloatBufferImpl.java +++ b/java/nio/FloatBufferImpl.java @@ -50,7 +50,8 @@ final class FloatBufferImpl extends FloatBuffer this (new float [capacity], 0, capacity, capacity, 0, -1, false); } - FloatBufferImpl (float[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly) + FloatBufferImpl (float[] buffer, int offset, int capacity, int limit, + int position, int mark, boolean readOnly) { super (capacity, limit, position, mark, null, buffer, offset); this.readOnly = readOnly; diff --git a/java/nio/IntBuffer.java b/java/nio/IntBuffer.java index 3820b5c3e..8ec10afe2 100644 --- a/java/nio/IntBuffer.java +++ b/java/nio/IntBuffer.java @@ -49,7 +49,8 @@ public abstract class IntBuffer extends Buffer final int array_offset; final int[] backing_buffer; - IntBuffer (int capacity, int limit, int position, int mark, Pointer address, int[] backing_buffer, int array_offset) + IntBuffer (int capacity, int limit, int position, int mark, + Pointer address, int[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; @@ -73,7 +74,8 @@ public abstract class IntBuffer extends Buffer */ public static final IntBuffer wrap (int[] array, int offset, int length) { - return new IntBufferImpl (array, 0, array.length, offset + length, offset, -1, false); + return new IntBufferImpl (array, 0, array.length, offset + length, offset, + -1, false); } /** diff --git a/java/nio/LongBuffer.java b/java/nio/LongBuffer.java index e46647673..55feb89df 100644 --- a/java/nio/LongBuffer.java +++ b/java/nio/LongBuffer.java @@ -49,7 +49,8 @@ public abstract class LongBuffer extends Buffer final int array_offset; final long[] backing_buffer; - LongBuffer (int capacity, int limit, int position, int mark, Pointer address, long[] backing_buffer, int array_offset) + LongBuffer (int capacity, int limit, int position, int mark, + Pointer address, long[] backing_buffer, int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; diff --git a/java/nio/LongBufferImpl.java b/java/nio/LongBufferImpl.java index 39733ac9b..4cf922b14 100644 --- a/java/nio/LongBufferImpl.java +++ b/java/nio/LongBufferImpl.java @@ -50,7 +50,8 @@ final class LongBufferImpl extends LongBuffer this (new long [capacity], 0, capacity, capacity, 0, -1, false); } - LongBufferImpl (long[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly) + LongBufferImpl (long[] buffer, int offset, int capacity, int limit, + int position, int mark, boolean readOnly) { super (capacity, limit, position, mark, null, buffer, offset); this.readOnly = readOnly; @@ -63,17 +64,20 @@ final class LongBufferImpl extends LongBuffer public LongBuffer slice () { - return new LongBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ()); + return new LongBufferImpl (backing_buffer, array_offset + position (), + remaining (), remaining (), 0, -1, isReadOnly ()); } public LongBuffer duplicate () { - return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ()); + return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), + position (), mark, isReadOnly ()); } public LongBuffer asReadOnlyBuffer () { - return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true); + return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), + position (), mark, true); } public LongBuffer compact () diff --git a/java/nio/MappedByteBuffer.java b/java/nio/MappedByteBuffer.java index be22bdaaf..f0365cb96 100644 --- a/java/nio/MappedByteBuffer.java +++ b/java/nio/MappedByteBuffer.java @@ -46,7 +46,8 @@ import gnu.classpath.Pointer; */ public abstract class MappedByteBuffer extends ByteBuffer { - MappedByteBuffer (int capacity, int limit, int position, int mark, Pointer address) + MappedByteBuffer (int capacity, int limit, int position, int mark, + Pointer address) { super (capacity, limit, position, mark, address, null, 0); } diff --git a/java/nio/ShortBuffer.java b/java/nio/ShortBuffer.java index c276fbd25..e6bfe1e35 100644 --- a/java/nio/ShortBuffer.java +++ b/java/nio/ShortBuffer.java @@ -49,7 +49,9 @@ public abstract class ShortBuffer extends Buffer final int array_offset; final short[] backing_buffer; - ShortBuffer (int capacity, int limit, int position, int mark, Pointer address, short[] backing_buffer, int array_offset) + ShortBuffer (int capacity, int limit, int position, + int mark, Pointer address, short[] backing_buffer, + int array_offset) { super (capacity, limit, position, mark, address); this.backing_buffer = backing_buffer; diff --git a/java/nio/ShortBufferImpl.java b/java/nio/ShortBufferImpl.java index 2274ba7dd..3a8ff57f8 100644 --- a/java/nio/ShortBufferImpl.java +++ b/java/nio/ShortBufferImpl.java @@ -50,7 +50,8 @@ final class ShortBufferImpl extends ShortBuffer this (new short [capacity], 0, capacity, capacity, 0, -1, false); } - ShortBufferImpl (short[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly) + ShortBufferImpl (short[] buffer, int offset, int capacity, + int limit, int position, int mark, boolean readOnly) { super (capacity, limit, position, mark, null, buffer, offset); this.readOnly = readOnly; @@ -63,17 +64,20 @@ final class ShortBufferImpl extends ShortBuffer public ShortBuffer slice () { - return new ShortBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ()); + return new ShortBufferImpl (backing_buffer, array_offset + position (), + remaining (), remaining (), 0, -1, isReadOnly ()); } public ShortBuffer duplicate () { - return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ()); + return new ShortBufferImpl (backing_buffer, array_offset, capacity (), + limit (), position (), mark, isReadOnly ()); } public ShortBuffer asReadOnlyBuffer () { - return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true); + return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (), + position (), mark, true); } public ShortBuffer compact () diff --git a/java/nio/ShortViewBufferImpl.java b/java/nio/ShortViewBufferImpl.java index 3c7c77478..627085556 100644 --- a/java/nio/ShortViewBufferImpl.java +++ b/java/nio/ShortViewBufferImpl.java @@ -49,7 +49,8 @@ final class ShortViewBufferImpl extends ShortBuffer ShortViewBufferImpl (ByteBuffer bb, int capacity) { super (capacity, capacity, 0, -1, bb.isDirect() ? - VMDirectByteBuffer.adjustAddress(bb.address, bb.position()):null, null, 0); + VMDirectByteBuffer.adjustAddress(bb.address, bb.position()):null, + null, 0); this.bb = bb; this.offset = bb.position(); this.readOnly = bb.isReadOnly(); @@ -61,7 +62,8 @@ final class ShortViewBufferImpl extends ShortBuffer boolean readOnly, ByteOrder endian) { super (capacity, limit, position, mark, bb.isDirect() ? - VMDirectByteBuffer.adjustAddress(bb.address, offset):null, null, 0); + VMDirectByteBuffer.adjustAddress(bb.address, offset):null, + null, 0); this.bb = bb; this.offset = offset; this.readOnly = readOnly; |