OSDN Git Service

2003-03-20 Michael Koch <konqueror@gmx.de>
[pf3gnuchains/gcc-fork.git] / libjava / gnu / java / nio / natFileChannelImpl.cc
1 // natFileChannelImpl.cc
2
3 /* Copyright (C) 2003  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #include <config.h>
12
13 #include <jvm.h>
14
15 #include <errno.h>
16 #include <string.h>
17 #include <sys/types.h>
18
19 #ifdef HAVE_UNISTD_H
20 #include <unistd.h>
21 #endif
22
23 #ifdef HAVE_FCNTL_H
24 #include <fcntl.h>
25 #endif
26
27 #include <gnu/gcj/RawData.h>
28 #include <gnu/java/nio/FileChannelImpl.h>
29 #include <java/io/FileDescriptor.h>
30 #include <java/io/IOException.h>
31 #include <java/nio/channels/FileChannel.h>
32
33 jlong
34 gnu::java::nio::FileChannelImpl::size ()
35 {
36   return fd->length ();
37 }
38
39 jlong
40 gnu::java::nio::FileChannelImpl::implPosition ()
41 {
42   return fd->getFilePointer ();
43 }
44
45 java::nio::channels::FileChannel*
46 gnu::java::nio::FileChannelImpl::implPosition (jlong newPosition)
47 {
48   fd->seek (newPosition, ::java::io::FileDescriptor::SET, true);
49   return this;
50 }
51
52 java::nio::channels::FileChannel*
53 gnu::java::nio::FileChannelImpl::implTruncate (jlong size)
54 {
55   fd->setLength (size);
56   return this;
57 }
58
59 gnu::gcj::RawData*
60 gnu::java::nio::FileChannelImpl::nio_mmap_file (jlong pos, jlong size, jint /*mode*/)
61 {
62   throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
63 }
64
65 void
66 gnu::java::nio::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* map_address, jint size)
67 {
68   throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
69 }
70
71 void
72 gnu::java::nio::FileChannelImpl::nio_msync (gnu::gcj::RawData* map_address, jint length)
73 {
74   throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));
75 }