r = writeInternal(context, this, fd, ptrBytes, ptr + offset, l);
r = writeInternal2(fd, dsBytes, ds, dpPtr.p - ds); else r = writeInternal(context, this, fd, dsBytes, ds, dpPtr.p - ds); if (r == dpPtr.p - ds) break outer;
r = writeInternal2(fd, dsBytes, ds, dpPtr.p - ds); else r = writeInternal(context, this, fd, dsBytes, ds, dpPtr.p - ds); if (r == dpPtr.p - ds) break outer;
r = writeInternal(context, this, fd, ptrBytes, ptr + offset, l);
@JRubyMethod(name = "syswrite", required = 1) public IRubyObject syswrite(ThreadContext context, IRubyObject str) { Ruby runtime = context.runtime; OpenFile fptr; long n; if (!(str instanceof RubyString)) str = str.asString(); RubyIO io = GetWriteIO(); fptr = io.getOpenFileChecked(); boolean locked = fptr.lock(); try { fptr.checkWritable(context); str = str.convertToString().dupFrozen(); if (fptr.wbuf.len != 0) { runtime.getWarnings().warn("syswrite for buffered IO"); } ByteList strByteList = ((RubyString) str).getByteList(); n = OpenFile.writeInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize()); if (n == -1) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath()); } finally { if (locked) fptr.unlock(); } return runtime.newFixnum(n); }
@JRubyMethod(name = "syswrite", required = 1) public IRubyObject syswrite(ThreadContext context, IRubyObject str) { Ruby runtime = context.runtime; OpenFile fptr; long n; if (!(str instanceof RubyString)) str = str.asString(); RubyIO io = GetWriteIO(); fptr = io.getOpenFileChecked(); boolean locked = fptr.lock(); try { fptr.checkWritable(context); str = str.convertToString().dupFrozen(); if (fptr.wbuf.len != 0) { runtime.getWarnings().warn("syswrite for buffered IO"); } ByteList strByteList = ((RubyString) str).getByteList(); n = OpenFile.writeInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize()); if (n == -1) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath()); } finally { if (locked) fptr.unlock(); } return runtime.newFixnum(n); }