From 7318eb21d1fc8ae39dae0e6c4f7c3da8f5ae5865 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Sat, 2 Aug 2003 11:17:40 +0000 Subject: 2003-08-02 Michael Koch * 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 --- libjava/java/nio/channels/FileChannelImpl.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libjava/java/nio/channels') diff --git a/libjava/java/nio/channels/FileChannelImpl.java b/libjava/java/nio/channels/FileChannelImpl.java index 9d61055..85113a0 100644 --- a/libjava/java/nio/channels/FileChannelImpl.java +++ b/libjava/java/nio/channels/FileChannelImpl.java @@ -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); } -- cgit v1.1