diff options
author | jfrijters <jfrijters> | 2011-08-19 13:09:50 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-08-19 13:09:50 +0400 |
commit | 2462429eb70e7d88d13a6346dd7dfd66997854a4 (patch) | |
tree | b143ffbdf3827d7331eee9878a48e8c5a95b0608 /openjdk/sun/nio/ch/IOUtil.java | |
parent | 2cd50131348935516c15df129863810ec9271f47 (diff) |
Implemented positional read/write.
Diffstat (limited to 'openjdk/sun/nio/ch/IOUtil.java')
-rw-r--r-- | openjdk/sun/nio/ch/IOUtil.java | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/openjdk/sun/nio/ch/IOUtil.java b/openjdk/sun/nio/ch/IOUtil.java index fe5caaef..45b9b704 100644 --- a/openjdk/sun/nio/ch/IOUtil.java +++ b/openjdk/sun/nio/ch/IOUtil.java @@ -73,8 +73,23 @@ class IOUtil { { if (dst.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); + if (position != -1) - throw new ikvm.internal.NotYetImplementedError(); + { + synchronized (lock) + { + long prevpos = fd.getFilePointer(); + try + { + fd.seek(position); + return read(fd, dst, -1, nd, null); + } + finally + { + fd.seek(prevpos); + } + } + } if (dst.hasArray()) { @@ -109,7 +124,21 @@ class IOUtil { throws IOException { if (position != -1) - throw new ikvm.internal.NotYetImplementedError(); + { + synchronized (lock) + { + long prevpos = fd.getFilePointer(); + try + { + fd.seek(position); + return write(fd, src, -1, nd, null); + } + finally + { + fd.seek(prevpos); + } + } + } if (src.hasArray()) { |