< prev index next >

src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java

Print this page




  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.io.FileDescriptor;
  29 import java.io.IOException;
  30 
  31 class FileDispatcherImpl extends FileDispatcher {
  32 


  33     static {
  34         IOUtil.load();
  35         init();
  36     }
  37 
  38     FileDispatcherImpl() {
  39     }
  40 
  41     int read(FileDescriptor fd, long address, int len) throws IOException {
  42         return read0(fd, address, len);
  43     }
  44 
  45     int pread(FileDescriptor fd, long address, int len, long position)
  46         throws IOException
  47     {
  48         return pread0(fd, address, len, position);
  49     }
  50 
  51     long readv(FileDescriptor fd, long address, int len) throws IOException {
  52         return readv0(fd, address, len);
  53     }
  54 














  55     int write(FileDescriptor fd, long address, int len) throws IOException {
  56         return write0(fd, address, len);
  57     }
  58 
  59     int pwrite(FileDescriptor fd, long address, int len, long position)
  60         throws IOException
  61     {
  62         return pwrite0(fd, address, len, position);
  63     }
  64 
  65     long writev(FileDescriptor fd, long address, int len)
  66         throws IOException
  67     {
  68         return writev0(fd, address, len);
  69     }
  70 
















  71     int force(FileDescriptor fd, boolean metaData) throws IOException {
  72         return force0(fd, metaData);
  73     }
  74 
  75     int truncate(FileDescriptor fd, long size) throws IOException {
  76         return truncate0(fd, size);
  77     }
  78 
  79     long size(FileDescriptor fd) throws IOException {
  80         return size0(fd);
  81     }
  82 
  83     int lock(FileDescriptor fd, boolean blocking, long pos, long size,
  84              boolean shared) throws IOException
  85     {
  86         return lock0(fd, blocking, pos, size, shared);
  87     }
  88 
  89     void release(FileDescriptor fd, long pos, long size) throws IOException {
  90         release0(fd, pos, size);


 106 
 107     boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
 108         return true;
 109     }
 110 
 111     boolean transferToDirectlyNeedsPositionLock() {
 112         return false;
 113     }
 114 
 115     // -- Native methods --
 116 
 117     static native int read0(FileDescriptor fd, long address, int len)
 118         throws IOException;
 119 
 120     static native int pread0(FileDescriptor fd, long address, int len,
 121                              long position) throws IOException;
 122 
 123     static native long readv0(FileDescriptor fd, long address, int len)
 124         throws IOException;
 125 









 126     static native int write0(FileDescriptor fd, long address, int len)
 127         throws IOException;
 128 
 129     static native int pwrite0(FileDescriptor fd, long address, int len,
 130                              long position) throws IOException;
 131 
 132     static native long writev0(FileDescriptor fd, long address, int len)
 133         throws IOException;
 134 









 135     static native int force0(FileDescriptor fd, boolean metaData)
 136         throws IOException;
 137 
 138     static native int truncate0(FileDescriptor fd, long size)
 139         throws IOException;
 140 
 141     static native long size0(FileDescriptor fd) throws IOException;
 142 
 143     static native int lock0(FileDescriptor fd, boolean blocking, long pos,
 144                             long size, boolean shared) throws IOException;
 145 
 146     static native void release0(FileDescriptor fd, long pos, long size)
 147         throws IOException;
 148 
 149     static native void close0(FileDescriptor fd) throws IOException;
 150 
 151     static native void preClose0(FileDescriptor fd) throws IOException;
 152 
 153     static native void closeIntFD(int fd) throws IOException;
 154 
 155     static native void init();
 156 
 157 }


  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.io.FileDescriptor;
  29 import java.io.IOException;
  30 
  31 class FileDispatcherImpl extends FileDispatcher {
  32 
  33     private int pageSize = -1;
  34 
  35     static {
  36         IOUtil.load();
  37         init();
  38     }
  39 
  40     FileDispatcherImpl() {
  41     }
  42 
  43     int read(FileDescriptor fd, long address, int len) throws IOException {
  44         return read0(fd, address, len);
  45     }
  46 
  47     int pread(FileDescriptor fd, long address, int len, long position)
  48         throws IOException
  49     {
  50         return pread0(fd, address, len, position);
  51     }
  52 
  53     long readv(FileDescriptor fd, long address, int len) throws IOException {
  54         return readv0(fd, address, len);
  55     }
  56 
  57     int readDirect(FileDescriptor fd, long address, int len) throws IOException {
  58         return readDirect0(fd, address, len);
  59     }
  60 
  61     int preadDirect(FileDescriptor fd, long address, int len, long position)
  62         throws IOException
  63     {
  64         return preadDirect0(fd, address, len, position);
  65     }
  66 
  67     long readvDirect(FileDescriptor fd, long address, int len) throws IOException {
  68         return readvDirect0(fd, address, len);
  69     }
  70 
  71     int write(FileDescriptor fd, long address, int len) throws IOException {
  72         return write0(fd, address, len);
  73     }
  74 
  75     int pwrite(FileDescriptor fd, long address, int len, long position)
  76         throws IOException
  77     {
  78         return pwrite0(fd, address, len, position);
  79     }
  80 
  81     long writev(FileDescriptor fd, long address, int len)
  82         throws IOException
  83     {
  84         return writev0(fd, address, len);
  85     }
  86 
  87     int writeDirect(FileDescriptor fd, long address, int len) throws IOException {
  88         return writeDirect0(fd, address, len);
  89     }
  90 
  91     int pwriteDirect(FileDescriptor fd, long address, int len, long position)
  92         throws IOException
  93     {
  94         return pwriteDirect0(fd, address, len, position);
  95     }
  96 
  97     long writevDirect(FileDescriptor fd, long address, int len)
  98         throws IOException
  99     {
 100         return writevDirect0(fd, address, len);
 101     }
 102 
 103     int force(FileDescriptor fd, boolean metaData) throws IOException {
 104         return force0(fd, metaData);
 105     }
 106 
 107     int truncate(FileDescriptor fd, long size) throws IOException {
 108         return truncate0(fd, size);
 109     }
 110 
 111     long size(FileDescriptor fd) throws IOException {
 112         return size0(fd);
 113     }
 114 
 115     int lock(FileDescriptor fd, boolean blocking, long pos, long size,
 116              boolean shared) throws IOException
 117     {
 118         return lock0(fd, blocking, pos, size, shared);
 119     }
 120 
 121     void release(FileDescriptor fd, long pos, long size) throws IOException {
 122         release0(fd, pos, size);


 138 
 139     boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
 140         return true;
 141     }
 142 
 143     boolean transferToDirectlyNeedsPositionLock() {
 144         return false;
 145     }
 146 
 147     // -- Native methods --
 148 
 149     static native int read0(FileDescriptor fd, long address, int len)
 150         throws IOException;
 151 
 152     static native int pread0(FileDescriptor fd, long address, int len,
 153                              long position) throws IOException;
 154 
 155     static native long readv0(FileDescriptor fd, long address, int len)
 156         throws IOException;
 157 
 158     static native int readDirect0(FileDescriptor fd, long address, int len)
 159         throws IOException;
 160 
 161     static native int preadDirect0(FileDescriptor fd, long address, int len,
 162                              long position) throws IOException;
 163 
 164     static native long readvDirect0(FileDescriptor fd, long address, int len)
 165         throws IOException;
 166 
 167     static native int write0(FileDescriptor fd, long address, int len)
 168         throws IOException;
 169 
 170     static native int pwrite0(FileDescriptor fd, long address, int len,
 171                              long position) throws IOException;
 172 
 173     static native long writev0(FileDescriptor fd, long address, int len)
 174         throws IOException;
 175 
 176     static native int writeDirect0(FileDescriptor fd, long address, int len)
 177         throws IOException;
 178 
 179     static native int pwriteDirect0(FileDescriptor fd, long address, int len,
 180                              long position) throws IOException;
 181 
 182     static native long writevDirect0(FileDescriptor fd, long address, int len)
 183         throws IOException;
 184 
 185     static native int force0(FileDescriptor fd, boolean metaData)
 186         throws IOException;
 187 
 188     static native int truncate0(FileDescriptor fd, long size)
 189         throws IOException;
 190 
 191     static native long size0(FileDescriptor fd) throws IOException;
 192 
 193     static native int lock0(FileDescriptor fd, boolean blocking, long pos,
 194                             long size, boolean shared) throws IOException;
 195 
 196     static native void release0(FileDescriptor fd, long pos, long size)
 197         throws IOException;
 198 
 199     static native void close0(FileDescriptor fd) throws IOException;
 200 
 201     static native void preClose0(FileDescriptor fd) throws IOException;
 202 
 203     static native void closeIntFD(int fd) throws IOException;
 204 
 205     static native void init();

 206 }
< prev index next >