FileDispatcherImpl.java revision 893
0N/A/*
893N/A * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Sun designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Sun in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A */
0N/A
0N/Apackage sun.nio.ch;
0N/A
0N/Aimport java.io.*;
0N/A
893N/Aclass FileDispatcherImpl extends FileDispatcher
0N/A{
0N/A
0N/A static {
0N/A Util.load();
0N/A }
0N/A
0N/A int read(FileDescriptor fd, long address, int len)
0N/A throws IOException
0N/A {
0N/A return read0(fd, address, len);
0N/A }
0N/A
0N/A int pread(FileDescriptor fd, long address, int len,
0N/A long position, Object lock) throws IOException
0N/A {
0N/A synchronized(lock) {
0N/A return pread0(fd, address, len, position);
0N/A }
0N/A }
0N/A
0N/A long readv(FileDescriptor fd, long address, int len) throws IOException {
0N/A return readv0(fd, address, len);
0N/A }
0N/A
0N/A int write(FileDescriptor fd, long address, int len) throws IOException {
0N/A return write0(fd, address, len);
0N/A }
0N/A
0N/A int pwrite(FileDescriptor fd, long address, int len,
0N/A long position, Object lock) throws IOException
0N/A {
0N/A synchronized(lock) {
0N/A return pwrite0(fd, address, len, position);
0N/A }
0N/A }
0N/A
0N/A long writev(FileDescriptor fd, long address, int len) throws IOException {
0N/A return writev0(fd, address, len);
0N/A }
0N/A
893N/A int force(FileDescriptor fd, boolean metaData) throws IOException {
893N/A return force0(fd, metaData);
893N/A }
893N/A
893N/A int truncate(FileDescriptor fd, long size) throws IOException {
893N/A return truncate0(fd, size);
893N/A }
893N/A
893N/A long size(FileDescriptor fd) throws IOException {
893N/A return size0(fd);
893N/A }
893N/A
893N/A int lock(FileDescriptor fd, boolean blocking, long pos, long size,
893N/A boolean shared) throws IOException
893N/A {
893N/A return lock0(fd, blocking, pos, size, shared);
893N/A }
893N/A
893N/A void release(FileDescriptor fd, long pos, long size) throws IOException {
893N/A release0(fd, pos, size);
893N/A }
893N/A
0N/A void close(FileDescriptor fd) throws IOException {
0N/A close0(fd);
0N/A }
0N/A
0N/A //-- Native methods
0N/A
0N/A static native int read0(FileDescriptor fd, long address, int len)
0N/A throws IOException;
0N/A
0N/A static native int pread0(FileDescriptor fd, long address, int len,
0N/A long position) throws IOException;
0N/A
0N/A static native long readv0(FileDescriptor fd, long address, int len)
0N/A throws IOException;
0N/A
0N/A static native int write0(FileDescriptor fd, long address, int len)
0N/A throws IOException;
0N/A
0N/A static native int pwrite0(FileDescriptor fd, long address, int len,
0N/A long position) throws IOException;
0N/A
0N/A static native long writev0(FileDescriptor fd, long address, int len)
0N/A throws IOException;
0N/A
893N/A static native int force0(FileDescriptor fd, boolean metaData)
893N/A throws IOException;
893N/A
893N/A static native int truncate0(FileDescriptor fd, long size)
893N/A throws IOException;
893N/A
893N/A static native long size0(FileDescriptor fd) throws IOException;
893N/A
893N/A static native int lock0(FileDescriptor fd, boolean blocking, long pos,
893N/A long size, boolean shared) throws IOException;
893N/A
893N/A static native void release0(FileDescriptor fd, long pos, long size)
893N/A throws IOException;
893N/A
0N/A static native void close0(FileDescriptor fd) throws IOException;
0N/A
0N/A static native void closeByHandle(long fd) throws IOException;
0N/A
0N/A}