1 // natFileChannelImpl.cc
3 /* Copyright (C) 2003 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
17 #include <sys/types.h>
27 #include <gnu/gcj/RawData.h>
28 #include <java/io/FileDescriptor.h>
29 #include <java/io/IOException.h>
30 #include <java/nio/ByteBuffer.h>
31 #include <java/nio/channels/FileChannel.h>
32 #include <java/nio/channels/FileChannelImpl.h>
35 java::nio::channels::FileChannelImpl::size ()
37 return fd
->getLength ();
41 java::nio::channels::FileChannelImpl::implPosition ()
43 return fd
->getFilePointer ();
46 java::nio::channels::FileChannel
*
47 java::nio::channels::FileChannelImpl::implPosition (jlong newPosition
)
49 fd
->seek (newPosition
, ::java::io::FileDescriptor::SET
, true);
54 java::nio::channels::FileChannelImpl::implRead (JArray
<jbyte
>* buffer
,
55 jint offset
, jint len
)
57 return fd
->read (buffer
, offset
, len
);
61 java::nio::channels::FileChannelImpl::implWrite (JArray
<jbyte
>* buffer
,
62 jint offset
, jint len
)
64 fd
->write (buffer
, offset
, len
);
68 java::nio::channels::FileChannel
*
69 java::nio::channels::FileChannelImpl::implTruncate (jlong size
)
76 java::nio::channels::FileChannelImpl::nio_mmap_file (jlong
/*pos*/, jlong
/*size*/,
79 throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
83 java::nio::channels::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData
* /*address*/,
86 throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
90 java::nio::channels::FileChannelImpl::nio_msync (gnu::gcj::RawData
* /*map_address*/,
93 throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));