public long transferFrom(FileChannel src, final long position, final long count)
     throws IOException {
   if (allAreSet(state, WRITE_SHUTDOWN)) {
     throw new ClosedChannelException();
   }
   if (count == 0L) return 0L;
   final long res;
   src = thread.getWorker().getXnio().unwrapFileChannel(src);
   if (Native.HAS_SENDFILE && src instanceof FileChannelImpl) {
     res = Native.testAndThrowRead(Native.sendfile(fd, src, position, count));
     if (Native.EXTRA_TRACE) log.tracef("Sendfile(%s -> %d): %d", src, fd, res);
   } else {
     res = src.transferTo(position, count, new ConduitWritableByteChannel(this));
   }
   if (res == 0) state &= ~WRITE_READY;
   checkWriteTimeout(res > 0);
   return res;
 }
 public long transferFrom(
     final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer)
     throws IOException {
   if (allAreSet(state, WRITE_SHUTDOWN)) {
     throw new ClosedChannelException();
   }
   if (count == 0L) return 0L;
   final long res;
   checkWriteTimeout(false);
   if (Native.HAS_SPLICE && source instanceof NativeDescriptor) {
     res =
         Native.testAndThrowRead(
             Native.transfer(((NativeDescriptor) source).fd, count, throughBuffer, fd));
     if (Native.EXTRA_TRACE) log.tracef("Splice(%s -> %d): %d", source, fd, res);
   } else {
     res = Conduits.transfer(source, count, throughBuffer, this);
   }
   if (res == 0) state &= ~WRITE_READY;
   if (res > 0) checkWriteTimeout(true);
   return res;
 }