< prev index next >

src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java

Print this page




  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.*;
  29 
  30 /**
  31  * Allows different platforms to call different native methods
  32  * for read and write operations.
  33  */
  34 
  35 abstract class NativeDispatcher
  36 {
  37 
  38     abstract int read(FileDescriptor fd, long address, int len)
  39         throws IOException;
  40 






  41     /**
  42      * Returns {@code true} if pread/pwrite needs to be synchronized with
  43      * position sensitive methods.
  44      */
  45     boolean needsPositionLock() {
  46         return false;
  47     }
  48 
  49     int pread(FileDescriptor fd, long address, int len, long position)
  50         throws IOException
  51     {
  52         throw new IOException("Operation Unsupported");
  53     }
  54 






  55     abstract long readv(FileDescriptor fd, long address, int len)
  56         throws IOException;
  57 






  58     abstract int write(FileDescriptor fd, long address, int len)
  59         throws IOException;
  60 






  61     int pwrite(FileDescriptor fd, long address, int len, long position)
  62         throws IOException
  63     {
  64         throw new IOException("Operation Unsupported");
  65     }
  66 






  67     abstract long writev(FileDescriptor fd, long address, int len)
  68         throws IOException;






  69 
  70     abstract void close(FileDescriptor fd) throws IOException;
  71 
  72     // Prepare the given fd for closing by duping it to a known internal fd
  73     // that's already closed.  This is necessary on some operating systems
  74     // (Solaris and Linux) to prevent fd recycling.
  75     //
  76     void preClose(FileDescriptor fd) throws IOException {
  77         // Do nothing by default; this is only needed on Unix
  78     }
  79 
  80 }


  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.*;
  29 
  30 /**
  31  * Allows different platforms to call different native methods
  32  * for read and write operations.
  33  */
  34 
  35 abstract class NativeDispatcher
  36 {
  37 
  38     abstract int read(FileDescriptor fd, long address, int len)
  39         throws IOException;
  40 
  41     int readDirect(FileDescriptor fd, long address, int len)
  42         throws IOException
  43     {
  44         throw new IOException("Operation Unsupported");
  45     }
  46 
  47     /**
  48      * Returns {@code true} if pread/pwrite needs to be synchronized with
  49      * position sensitive methods.
  50      */
  51     boolean needsPositionLock() {
  52         return false;
  53     }
  54 
  55     int pread(FileDescriptor fd, long address, int len, long position)
  56         throws IOException
  57     {
  58         throw new IOException("Operation Unsupported");
  59     }
  60 
  61     int preadDirect(FileDescriptor fd, long address, int len, long position)
  62         throws IOException
  63     {
  64         throw new IOException("Operation Unsupported");
  65     }
  66 
  67     abstract long readv(FileDescriptor fd, long address, int len)
  68         throws IOException;
  69 
  70     long readvDirect(FileDescriptor fd, long address, int len)
  71         throws IOException
  72     {
  73         throw new IOException("Operation Unsupported");
  74     }
  75 
  76     abstract int write(FileDescriptor fd, long address, int len)
  77         throws IOException;
  78 
  79     int writeDirect(FileDescriptor fd, long address, int len)
  80         throws IOException
  81     {
  82         throw new IOException("Operation Unsupported");
  83     }
  84 
  85     int pwrite(FileDescriptor fd, long address, int len, long position)
  86         throws IOException
  87     {
  88         throw new IOException("Operation Unsupported");
  89     }
  90 
  91     int pwriteDirect(FileDescriptor fd, long address, int len, long position)
  92         throws IOException
  93     {
  94         throw new IOException("Operation Unsupported");
  95     }
  96 
  97     abstract long writev(FileDescriptor fd, long address, int len)
  98         throws IOException;
  99 
 100     long writevDirect(FileDescriptor fd, long address, int len)
 101         throws IOException
 102     {
 103         throw new IOException("Operation Unsupported");
 104     }
 105 
 106     abstract void close(FileDescriptor fd) throws IOException;
 107 
 108     // Prepare the given fd for closing by duping it to a known internal fd
 109     // that's already closed.  This is necessary on some operating systems
 110     // (Solaris and Linux) to prevent fd recycling.
 111     //
 112     void preClose(FileDescriptor fd) throws IOException {
 113         // Do nothing by default; this is only needed on Unix
 114     }
 115 
 116 }
< prev index next >