2003-08-02 Michael Koch <konqueror@gmx.de>
* java/nio/ByteBufferImpl.java (getChar): Check remaining bytes, fixed comment about endianess. (putChar): Likewise. (getShort): Likewise. (putShort): Likewise. (getInt): Check remaining bytes, fixed conversion, fixed comment about endianess. (putInt): Likewise. (getLong): Likewise. (putLong): Likewise. (getFloat): Likewise. (putFloat): Likewise. (getDouble): Likewise. (putDouble): Likewise. * java/nio/DirectByteBufferImpl.java (getChar): Wrapped code, fixed comment about endianess. (putchar): Likewise. (getShort): Likewise. (putShort): Likewise. (getInt): Fixed conversion, fixed comment about endianess. (putInt): Likewise. (getLong): Likewise. (putLong): Likewise. (getFloat): Likewise. (putFloat): Likewise. (getDouble): Likewise. (putDouble): Likewise. * java/nio/MappedByteBufferImpl.java (compact): Implemented. (getChar): Implemented. (putChar): Implemented. (getDouble): Implemented. (putdouble): Implemented. (getFloat): Implemented. (putFloat): Implemented. (getInt): Implemented. (putInt): Implemented. (getLong): Implemented. (putLong): Implemented. (getShort): Implemented. (putShort): Implemented. * java/nio/channels/FileChannelImpl.java (read): Set position where to access file. (write): Likewise. (transferTo): Flip buffer after read and before write. (transferFrom): Likewise. From-SVN: r70102
This commit is contained in:
parent
2937079664
commit
7318eb21d1
5 changed files with 300 additions and 138 deletions
|
@ -146,6 +146,7 @@ public class FileChannelImpl extends FileChannel
|
|||
long oldPosition;
|
||||
|
||||
oldPosition = implPosition ();
|
||||
position (position);
|
||||
result = implRead (dst);
|
||||
implPosition (oldPosition);
|
||||
|
||||
|
@ -208,6 +209,7 @@ public class FileChannelImpl extends FileChannel
|
|||
long oldPosition;
|
||||
|
||||
oldPosition = implPosition ();
|
||||
position (position);
|
||||
result = implWrite (src);
|
||||
implPosition (oldPosition);
|
||||
|
||||
|
@ -298,6 +300,7 @@ public class FileChannelImpl extends FileChannel
|
|||
// XXX: count needs to be casted from long to int. Dataloss ?
|
||||
ByteBuffer buffer = ByteBuffer.allocate ((int) count);
|
||||
read (buffer, position);
|
||||
buffer.flip();
|
||||
return target.write (buffer);
|
||||
}
|
||||
|
||||
|
@ -317,6 +320,7 @@ public class FileChannelImpl extends FileChannel
|
|||
// XXX: count needs to be casted from long to int. Dataloss ?
|
||||
ByteBuffer buffer = ByteBuffer.allocate ((int) count);
|
||||
src.read (buffer);
|
||||
buffer.flip();
|
||||
return write (buffer, position);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue