54c99af155
* gnu/java/nio/FileChannelImpl.java (address): Removed. (map_address): New member variable. (length): Make it package private. (fd): Make it package private. (buf): Make it package private. (file_obj): Make it package private. (FileChannelImpl): New constructor. (nio_mmap_file): Use RawData instead of long. (nio_munmap_file): Use RawData instead of long. (nio_msync): Use RawData instead of long. (implCloseChannel): New implementation using map_address. (read): Reformated. (map): Implemented. (create_direct_mapped_buffer): Implemented, use RawData, throws IOException. (force): Use map_address instead of address. * gnu/java/nio/MappedByteFileBuffer.java (address): Removed. (map_address): New member variable. (MappedByteFileBuffer): Use map_address instead of address, reformated. (several methods): Use map_address instead of address, replaced long with RawData where appropriate. * gnu/java/nio/natFileChannelImpl.cc (nio_mmap_file): Replaced long with RawData. (nio_munmap_file): Replaced long with RawData. (nio_msync): Replaced long with RawData. * gnu/java/nio/natMappedByteFileBuffer.cc (several methods): Replaced long with RawData where appropriate. From-SVN: r64612
76 lines
1.6 KiB
C++
76 lines
1.6 KiB
C++
// natFileChannelImpl.cc
|
|
|
|
/* Copyright (C) 2003 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
#include <config.h>
|
|
|
|
#include <jvm.h>
|
|
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
#include <fcntl.h>
|
|
#endif
|
|
|
|
#include <gnu/gcj/RawData.h>
|
|
#include <gnu/java/nio/FileChannelImpl.h>
|
|
#include <java/io/FileDescriptor.h>
|
|
#include <java/io/IOException.h>
|
|
#include <java/nio/channels/FileChannel.h>
|
|
|
|
jlong
|
|
gnu::java::nio::FileChannelImpl::size ()
|
|
{
|
|
return fd->length ();
|
|
}
|
|
|
|
jlong
|
|
gnu::java::nio::FileChannelImpl::implPosition ()
|
|
{
|
|
return fd->getFilePointer ();
|
|
}
|
|
|
|
java::nio::channels::FileChannel*
|
|
gnu::java::nio::FileChannelImpl::implPosition (jlong newPosition)
|
|
{
|
|
fd->seek (newPosition, ::java::io::FileDescriptor::SET, true);
|
|
return this;
|
|
}
|
|
|
|
java::nio::channels::FileChannel*
|
|
gnu::java::nio::FileChannelImpl::implTruncate (jlong size)
|
|
{
|
|
fd->setLength (size);
|
|
return this;
|
|
}
|
|
|
|
gnu::gcj::RawData*
|
|
gnu::java::nio::FileChannelImpl::nio_mmap_file (jlong pos, jlong size, jint /*mode*/)
|
|
{
|
|
throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
|
|
}
|
|
|
|
void
|
|
gnu::java::nio::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* map_address, jint size)
|
|
{
|
|
throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
|
|
}
|
|
|
|
void
|
|
gnu::java::nio::FileChannelImpl::nio_msync (gnu::gcj::RawData* map_address, jint length)
|
|
{
|
|
throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));
|
|
}
|