< prev index next >

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

Print this page
rev 48993 : imported patch nio

*** 53,64 **** static int write(FileDescriptor fd, ByteBuffer src, long position, boolean directIO, int alignment, NativeDispatcher nd) throws IOException { if (src instanceof DirectBuffer) { ! return writeFromNativeBuffer(fd, src, position, ! directIO, alignment, nd); } // Substitute a native buffer int pos = src.position(); int lim = src.limit(); --- 53,63 ---- static int write(FileDescriptor fd, ByteBuffer src, long position, boolean directIO, int alignment, NativeDispatcher nd) throws IOException { if (src instanceof DirectBuffer) { ! return writeFromNativeBuffer(fd, src, position, directIO, alignment, nd); } // Substitute a native buffer int pos = src.position(); int lim = src.limit();
*** 75,86 **** bb.put(src); bb.flip(); // Do not update src until we see how many bytes were written src.position(pos); ! int n = writeFromNativeBuffer(fd, bb, position, ! directIO, alignment, nd); if (n > 0) { // now update src src.position(pos + n); } return n; --- 74,84 ---- bb.put(src); bb.flip(); // Do not update src until we see how many bytes were written src.position(pos); ! int n = writeFromNativeBuffer(fd, bb, position, directIO, alignment, nd); if (n > 0) { // now update src src.position(pos + n); } return n;
*** 230,241 **** throws IOException { if (dst.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); if (dst instanceof DirectBuffer) ! return readIntoNativeBuffer(fd, dst, position, ! directIO, alignment, nd); // Substitute a native buffer ByteBuffer bb; int rem = dst.remaining(); if (directIO) { --- 228,238 ---- throws IOException { if (dst.isReadOnly()) throw new IllegalArgumentException("Read-only buffer"); if (dst instanceof DirectBuffer) ! return readIntoNativeBuffer(fd, dst, position, directIO, alignment, nd); // Substitute a native buffer ByteBuffer bb; int rem = dst.remaining(); if (directIO) {
*** 243,254 **** bb = Util.getTemporaryAlignedDirectBuffer(rem, alignment); } else { bb = Util.getTemporaryDirectBuffer(rem); } try { ! int n = readIntoNativeBuffer(fd, bb, position, ! directIO, alignment,nd); bb.flip(); if (n > 0) dst.put(bb); return n; } finally { --- 240,250 ---- bb = Util.getTemporaryAlignedDirectBuffer(rem, alignment); } else { bb = Util.getTemporaryDirectBuffer(rem); } try { ! int n = readIntoNativeBuffer(fd, bb, position, directIO, alignment,nd); bb.flip(); if (n > 0) dst.put(bb); return n; } finally {
< prev index next >