aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio/MappedByteBufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/nio/MappedByteBufferImpl.java')
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java133
1 files changed, 72 insertions, 61 deletions
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index 47673c6..f1d892f 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -1,5 +1,5 @@
/* MappedByteBufferImpl.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -111,15 +111,14 @@ public class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer compact ()
{
- int copied = 0;
-
- while (remaining () > 0)
+ int pos = position();
+ if (pos > 0)
{
- put (copied, get ());
- copied++;
+ int count = remaining();
+ shiftDown(0, pos, count);
+ position(count);
+ limit(capacity());
}
-
- position (copied);
return this;
}
@@ -145,151 +144,163 @@ public class MappedByteBufferImpl extends MappedByteBuffer
public CharBuffer asCharBuffer ()
{
- return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public ShortBuffer asShortBuffer ()
{
- return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public IntBuffer asIntBuffer ()
{
- return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public LongBuffer asLongBuffer ()
{
- return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public FloatBuffer asFloatBuffer ()
{
- return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public DoubleBuffer asDoubleBuffer ()
{
- return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
- public final char getChar()
+ final public char getChar ()
{
- return ByteBufferHelper.getChar (this);
+ return ByteBufferHelper.getChar(this, order());
}
- public final ByteBuffer putChar (char value)
+ final public ByteBuffer putChar (char value)
{
- return ByteBufferHelper.putChar (this, value);
+ ByteBufferHelper.putChar(this, value, order());
+ return this;
}
- public final char getChar (int index)
+ final public char getChar (int index)
{
- return ByteBufferHelper.getChar (this, index);
+ return ByteBufferHelper.getChar(this, index, order());
}
- public final ByteBuffer putChar (int index, char value)
+ final public ByteBuffer putChar (int index, char value)
{
- return ByteBufferHelper.putChar (this, index, value);
+ ByteBufferHelper.putChar(this, index, value, order());
+ return this;
}
- public final short getShort()
+ final public short getShort ()
{
- return ByteBufferHelper.getShort (this);
+ return ByteBufferHelper.getShort(this, order());
}
- public final ByteBuffer putShort (short value)
+ final public ByteBuffer putShort (short value)
{
- return ByteBufferHelper.putShort (this, value);
+ ByteBufferHelper.putShort(this, value, order());
+ return this;
}
- public final short getShort (int index)
+ final public short getShort (int index)
{
- return ByteBufferHelper.getShort (this, index);
+ return ByteBufferHelper.getShort(this, index, order());
}
- public final ByteBuffer putShort (int index, short value)
+ final public ByteBuffer putShort (int index, short value)
{
- return ByteBufferHelper.putShort (this, index, value);
+ ByteBufferHelper.putShort(this, index, value, order());
+ return this;
}
- public final int getInt()
+ final public int getInt ()
{
- return ByteBufferHelper.getInt (this);
+ return ByteBufferHelper.getInt(this, order());
}
- public final ByteBuffer putInt (int value)
+ final public ByteBuffer putInt (int value)
{
- return ByteBufferHelper.putInt (this, value);
+ ByteBufferHelper.putInt(this, value, order());
+ return this;
}
- public final int getInt (int index)
+ final public int getInt (int index)
{
- return ByteBufferHelper.getInt (this, index);
+ return ByteBufferHelper.getInt(this, index, order());
}
- public final ByteBuffer putInt (int index, int value)
+ final public ByteBuffer putInt (int index, int value)
{
- return ByteBufferHelper.putInt (this, index, value);
+ ByteBufferHelper.putInt(this, index, value, order());
+ return this;
}
- public final long getLong()
+ final public long getLong ()
{
- return ByteBufferHelper.getLong (this);
+ return ByteBufferHelper.getLong(this, order());
}
- public final ByteBuffer putLong (long value)
+ final public ByteBuffer putLong (long value)
{
- return ByteBufferHelper.putLong (this, value);
+ ByteBufferHelper.putLong (this, value, order());
+ return this;
}
- public final long getLong (int index)
+ final public long getLong (int index)
{
- return ByteBufferHelper.getLong (this, index);
+ return ByteBufferHelper.getLong (this, index, order());
}
- public final ByteBuffer putLong (int index, long value)
+ final public ByteBuffer putLong (int index, long value)
{
- return ByteBufferHelper.putLong (this, index, value);
+ ByteBufferHelper.putLong (this, index, value, order());
+ return this;
}
- public final float getFloat()
+ final public float getFloat ()
{
- return ByteBufferHelper.getFloat (this);
+ return ByteBufferHelper.getFloat (this, order());
}
- public final ByteBuffer putFloat (float value)
+ final public ByteBuffer putFloat (float value)
{
- return ByteBufferHelper.putFloat (this, value);
+ ByteBufferHelper.putFloat (this, value, order());
+ return this;
}
public final float getFloat (int index)
{
- return ByteBufferHelper.getFloat (this, index);
+ return ByteBufferHelper.getFloat (this, index, order());
}
- public final ByteBuffer putFloat (int index, float value)
+ final public ByteBuffer putFloat (int index, float value)
{
- return ByteBufferHelper.putFloat (this, index, value);
+ ByteBufferHelper.putFloat (this, index, value, order());
+ return this;
}
- public final double getDouble()
+ final public double getDouble ()
{
- return ByteBufferHelper.getDouble (this);
+ return ByteBufferHelper.getDouble (this, order());
}
- public final ByteBuffer putDouble (double value)
+ final public ByteBuffer putDouble (double value)
{
- return ByteBufferHelper.putDouble (this, value);
+ ByteBufferHelper.putDouble (this, value, order());
+ return this;
}
- public final double getDouble (int index)
+ final public double getDouble (int index)
{
- return ByteBufferHelper.getDouble (this, index);
+ return ByteBufferHelper.getDouble (this, index, order());
}
- public final ByteBuffer putDouble (int index, double value)
+ final public ByteBuffer putDouble (int index, double value)
{
- return ByteBufferHelper.putDouble (this, index, value);
+ ByteBufferHelper.putDouble (this, index, value, order());
+ return this;
}
}