< prev index next >

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

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


 124     boolean transferToDirectlyNeedsPositionLock() {
 125         return true;
 126     }
 127 
 128     int setDirectIO(FileDescriptor fd, String path) {
 129         int result = -1;
 130         String filePath = path.substring(0, path.lastIndexOf(File.separator));
 131         CharBuffer buffer = CharBuffer.allocate(filePath.length());
 132         buffer.put(filePath);
 133         try {
 134             result = setDirect0(fd, buffer);
 135         } catch (IOException e) {
 136             throw new UnsupportedOperationException
 137                 ("Error setting up DirectIO", e);
 138         }
 139         return result;
 140     }
 141 
 142     static boolean isFastFileTransferRequested() {
 143         String fileTransferProp = GetPropertyAction
 144                 .privilegedGetProperty("jdk.nio.enableFastFileTransfer");
 145         boolean enable;
 146         if ("".equals(fileTransferProp)) {
 147             enable = true;
 148         } else {
 149             enable = Boolean.parseBoolean(fileTransferProp);
 150         }
 151         return enable;
 152     }
 153 
 154     static {
 155         IOUtil.load();
 156         fastFileTransfer = isFastFileTransferRequested();
 157     }
 158 
 159     //-- Native methods
 160 
 161     static native int read0(FileDescriptor fd, long address, int len)
 162         throws IOException;
 163 
 164     static native int pread0(FileDescriptor fd, long address, int len,
 165                              long position) throws IOException;
 166 
 167     static native long readv0(FileDescriptor fd, long address, int len)
 168         throws IOException;
 169 
 170     static native int write0(FileDescriptor fd, long address, int len, boolean append)
 171         throws IOException;




 124     boolean transferToDirectlyNeedsPositionLock() {
 125         return true;
 126     }
 127 
 128     int setDirectIO(FileDescriptor fd, String path) {
 129         int result = -1;
 130         String filePath = path.substring(0, path.lastIndexOf(File.separator));
 131         CharBuffer buffer = CharBuffer.allocate(filePath.length());
 132         buffer.put(filePath);
 133         try {
 134             result = setDirect0(fd, buffer);
 135         } catch (IOException e) {
 136             throw new UnsupportedOperationException
 137                 ("Error setting up DirectIO", e);
 138         }
 139         return result;
 140     }
 141 
 142     static boolean isFastFileTransferRequested() {
 143         String fileTransferProp = GetPropertyAction
 144                 .privilegedGetProperty("jdk.nio.enableFastFileTransfer", "false");
 145         return fileTransferProp.isEmpty() ? true : Boolean.parseBoolean(fileTransferProp);






 146     }
 147 
 148     static {
 149         IOUtil.load();
 150         fastFileTransfer = isFastFileTransferRequested();
 151     }
 152 
 153     //-- Native methods
 154 
 155     static native int read0(FileDescriptor fd, long address, int len)
 156         throws IOException;
 157 
 158     static native int pread0(FileDescriptor fd, long address, int len,
 159                              long position) throws IOException;
 160 
 161     static native long readv0(FileDescriptor fd, long address, int len)
 162         throws IOException;
 163 
 164     static native int write0(FileDescriptor fd, long address, int len, boolean append)
 165         throws IOException;


< prev index next >