diff options
| author | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-12 11:36:21 +0000 |
|---|---|---|
| committer | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-12 11:36:21 +0000 |
| commit | 7ff7e6abd8b17e9d9c7551e8d76503fb18325daa (patch) | |
| tree | 37faea2330a248899efb9d9613d88810dad0ac98 /gnu/java/nio/FileChannelImpl.java | |
| parent | cc038371891900ee57b02542f26ecfa5b938f121 (diff) | |
| download | classpath-7ff7e6abd8b17e9d9c7551e8d76503fb18325daa.tar.gz | |
* Removes dependencies on manta; javax.swing,
gnu.java.nio and java.nio now compile with jikes;
Diffstat (limited to 'gnu/java/nio/FileChannelImpl.java')
| -rw-r--r-- | gnu/java/nio/FileChannelImpl.java | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/gnu/java/nio/FileChannelImpl.java b/gnu/java/nio/FileChannelImpl.java index 4e4505916..047a432af 100644 --- a/gnu/java/nio/FileChannelImpl.java +++ b/gnu/java/nio/FileChannelImpl.java @@ -1,4 +1,4 @@ -package manta.runtime; +package gnu.java.nio; import java.io.*; import java.nio.*; @@ -7,24 +7,37 @@ import java.nio.channels.*; public class FileChannelImpl extends FileChannel { - long address; - int fd; - MappedByteBuffer buf; - Object file_obj; // just to keep it live... + public long address, length; + public int fd; + public MappedByteBuffer buf; + public Object file_obj; // just to keep it live... - FileChannelImpl(int fd, - Object obj) + public FileChannelImpl(int fd, + Object obj) { this.fd = fd; this.file_obj = obj; } - FileChannelImpl(FileDescriptor fd, - Object obj) + public FileChannelImpl(FileDescriptor fd, + Object obj) { - this(fd.file_des, obj); + //this(fd.getNativeFD(), obj); + this(0, obj); + + System.err.println("we need to get the native file-des here !\n"); } + + + public boolean isOpen() + { + // FIXME + return fd != 0; + } + public void close() + { + } public int read(java.nio.ByteBuffer dst) throws IOException { @@ -38,7 +51,7 @@ public class FileChannelImpl extends FileChannel return 0; } - public int write(java.nio.ByteBuffer[] srcs, + public long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws IOException { @@ -46,12 +59,12 @@ public class FileChannelImpl extends FileChannel return 0; } - static MantaNative long nio_mmap_file(int fd, + static native long nio_mmap_file(int fd, long pos, int size, int mode); - static MantaNative void nio_unmmap_file(int fd, + static native void nio_unmmap_file(int fd, long pos, int size); @@ -66,5 +79,17 @@ public class FileChannelImpl extends FileChannel buf = new MappedByteFileBuffer(this); return buf; } + + static MappedByteBuffer create_direct_mapped_buffer(long address, + long length) + { + FileChannelImpl ch = new FileChannelImpl(-1, null); + + ch.address = address; + ch.length = length; + + ch.buf = new MappedByteFileBuffer(ch); + return ch.buf; + } } |
