fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / libjava / java / nio / channels / natFileChannelImpl.cc
blob8dbbd141e604625c81bf6766f1bb9be038b084b2
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
9 details. */
11 #include <config.h>
13 #include <jvm.h>
15 #include <errno.h>
16 #include <string.h>
17 #include <sys/types.h>
19 #ifdef HAVE_UNISTD_H
20 #include <unistd.h>
21 #endif
23 #ifdef HAVE_FCNTL_H
24 #include <fcntl.h>
25 #endif
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>
34 jlong
35 java::nio::channels::FileChannelImpl::size ()
37 return fd->getLength ();
40 jlong
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);
50 return this;
53 jint
54 java::nio::channels::FileChannelImpl::implRead (JArray<jbyte>* buffer,
55 jint offset, jint len)
57 return fd->read (buffer, offset, len);
60 jint
61 java::nio::channels::FileChannelImpl::implWrite (JArray<jbyte>* buffer,
62 jint offset, jint len)
64 fd->write (buffer, offset, len);
65 return len;
68 java::nio::channels::FileChannel*
69 java::nio::channels::FileChannelImpl::implTruncate (jlong size)
71 fd->setLength (size);
72 return this;
75 gnu::gcj::RawData*
76 java::nio::channels::FileChannelImpl::nio_mmap_file (jlong /*pos*/, jlong /*size*/,
77 jint /*mode*/)
79 throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
82 void
83 java::nio::channels::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* /*address*/,
84 jint /*size*/)
86 throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
89 void
90 java::nio::channels::FileChannelImpl::nio_msync (gnu::gcj::RawData* /*map_address*/,
91 jint /*length*/)
93 throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));