ByteBufferHelper.java: New file.
2003-09-25 Michael Koch <konqueror@gmx.de> * java/nio/ByteBufferHelper.java: New file. * java/nio/ByteBufferImpl.java, java/nio/DirectByteBufferImpl.java, java/nio/MappedByteBufferImpl.java (getType,putType): Use new helper class ByteBufferHelper. * Makefile.am (ordinary_java_source_files): Added java/nio/ByteBufferHelper.java. * Makefile.in: Regenerated. From-SVN: r71757
This commit is contained in:
parent
e302977341
commit
5e2ba18bc1
5 changed files with 739 additions and 423 deletions
|
@ -58,6 +58,15 @@ public class MappedByteBufferImpl extends MappedByteBuffer
|
|||
limit ((int) si);
|
||||
}
|
||||
|
||||
public MappedByteBufferImpl (FileChannelImpl ch, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
|
||||
{
|
||||
super (capacity, limit, position, mark);
|
||||
|
||||
this.ch = ch;
|
||||
this.array_offset = offset;
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
public boolean isReadOnly ()
|
||||
{
|
||||
return readOnly;
|
||||
|
@ -164,147 +173,123 @@ public class MappedByteBufferImpl extends MappedByteBuffer
|
|||
return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
|
||||
}
|
||||
|
||||
public char getChar ()
|
||||
public final char getChar()
|
||||
{
|
||||
char value = getChar (position());
|
||||
position (position() + 2);
|
||||
return value;
|
||||
return ByteBufferHelper.getChar (this);
|
||||
}
|
||||
|
||||
public final ByteBuffer putChar (char value)
|
||||
{
|
||||
return ByteBufferHelper.putChar (this, value);
|
||||
}
|
||||
|
||||
public final char getChar (int index)
|
||||
{
|
||||
return ByteBufferHelper.getChar (this, index);
|
||||
}
|
||||
|
||||
public final ByteBuffer putChar (int index, char value)
|
||||
{
|
||||
return ByteBufferHelper.putChar (this, index, value);
|
||||
}
|
||||
|
||||
public char getChar (int index)
|
||||
public final short getShort()
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
return ByteBufferHelper.getShort (this);
|
||||
}
|
||||
|
||||
public final ByteBuffer putShort (short value)
|
||||
{
|
||||
return ByteBufferHelper.putShort (this, value);
|
||||
}
|
||||
|
||||
public final short getShort (int index)
|
||||
{
|
||||
return ByteBufferHelper.getShort (this, index);
|
||||
}
|
||||
|
||||
public final ByteBuffer putShort (int index, short value)
|
||||
{
|
||||
return ByteBufferHelper.putShort (this, index, value);
|
||||
}
|
||||
|
||||
public ByteBuffer putChar (char value)
|
||||
public final int getInt()
|
||||
{
|
||||
putChar (position(), value);
|
||||
position (position() + 2);
|
||||
return this;
|
||||
return ByteBufferHelper.getInt (this);
|
||||
}
|
||||
|
||||
public final ByteBuffer putInt (int value)
|
||||
{
|
||||
return ByteBufferHelper.putInt (this, value);
|
||||
}
|
||||
|
||||
public final int getInt (int index)
|
||||
{
|
||||
return ByteBufferHelper.getInt (this, index);
|
||||
}
|
||||
|
||||
public final ByteBuffer putInt (int index, int value)
|
||||
{
|
||||
return ByteBufferHelper.putInt (this, index, value);
|
||||
}
|
||||
|
||||
public ByteBuffer putChar (int index, char value)
|
||||
public final long getLong()
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
return ByteBufferHelper.getLong (this);
|
||||
}
|
||||
|
||||
public final ByteBuffer putLong (long value)
|
||||
{
|
||||
return ByteBufferHelper.putLong (this, value);
|
||||
}
|
||||
|
||||
public final long getLong (int index)
|
||||
{
|
||||
return ByteBufferHelper.getLong (this, index);
|
||||
}
|
||||
|
||||
public final ByteBuffer putLong (int index, long value)
|
||||
{
|
||||
return ByteBufferHelper.putLong (this, index, value);
|
||||
}
|
||||
|
||||
public double getDouble ()
|
||||
public final float getFloat()
|
||||
{
|
||||
double value = getDouble (position());
|
||||
position (position() + 8);
|
||||
return value;
|
||||
return ByteBufferHelper.getFloat (this);
|
||||
}
|
||||
|
||||
public final ByteBuffer putFloat (float value)
|
||||
{
|
||||
return ByteBufferHelper.putFloat (this, value);
|
||||
}
|
||||
|
||||
public final float getFloat (int index)
|
||||
{
|
||||
return ByteBufferHelper.getFloat (this, index);
|
||||
}
|
||||
|
||||
public double getDouble (int index)
|
||||
public final ByteBuffer putFloat (int index, float value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
return ByteBufferHelper.putFloat (this, index, value);
|
||||
}
|
||||
|
||||
public ByteBuffer putDouble (double value)
|
||||
public final double getDouble()
|
||||
{
|
||||
putDouble (position(), value);
|
||||
position (position() + 8);
|
||||
return this;
|
||||
return ByteBufferHelper.getDouble (this);
|
||||
}
|
||||
|
||||
public ByteBuffer putDouble (int index, double value)
|
||||
public final ByteBuffer putDouble (double value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
return ByteBufferHelper.putDouble (this, value);
|
||||
}
|
||||
|
||||
public float getFloat ()
|
||||
|
||||
public final double getDouble (int index)
|
||||
{
|
||||
float value = getFloat (position ());
|
||||
position (position() + 4);
|
||||
return value;
|
||||
return ByteBufferHelper.getDouble (this, index);
|
||||
}
|
||||
|
||||
public float getFloat (int index)
|
||||
|
||||
public final ByteBuffer putDouble (int index, double value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public ByteBuffer putFloat (float value)
|
||||
{
|
||||
putFloat (position(), value);
|
||||
position (position() + 4);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ByteBuffer putFloat (int index, float value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public int getInt ()
|
||||
{
|
||||
int value = getInt (position());
|
||||
position (position() + 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getInt (int index)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public ByteBuffer putInt (int value)
|
||||
{
|
||||
putInt (position(), value);
|
||||
position (position() + 4);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ByteBuffer putInt (int index, int value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public long getLong ()
|
||||
{
|
||||
long value = getLong (position());
|
||||
position (position() + 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
public long getLong (int index)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public ByteBuffer putLong (long value)
|
||||
{
|
||||
putLong (position(), value);
|
||||
position (position() + 8);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ByteBuffer putLong (int index, long value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public short getShort ()
|
||||
{
|
||||
short value = getShort (position());
|
||||
position (position() + 2);
|
||||
return value;
|
||||
}
|
||||
|
||||
public short getShort (int index)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
}
|
||||
|
||||
public ByteBuffer putShort (short value)
|
||||
{
|
||||
putShort (position(), value);
|
||||
position (position() + 2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ByteBuffer putShort (int index, short value)
|
||||
{
|
||||
throw new Error ("Not implemented");
|
||||
return ByteBufferHelper.putDouble (this, index, value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue