public void fclose() throws IOException, BadDescriptorException { stream.fclose(); }
public void fclose() throws IOException, BadDescriptorException { stream.fclose(); }
public void fclose() throws IOException, BadDescriptorException { stream.fclose(); }
public void fclose() throws IOException, BadDescriptorException { stream.fclose(); }
@JRubyMethod(name = "close_write") public IRubyObject close_write(ThreadContext context) { try { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getPipeStream() == null && myOpenFile.isReadable()) { throw context.runtime.newIOError("closing non-duplex IO for writing"); } if (myOpenFile.getPipeStream() == null) { close(); } else{ myOpenFile.getPipeStream().fclose(); myOpenFile.setPipeStream(null); myOpenFile.setMode(myOpenFile.getMode() & ~OpenFile.WRITABLE); // TODO // n is result of fclose; but perhaps having a SysError below is enough? // if (n != 0) rb_sys_fail(fptr->path); } } catch (BadDescriptorException bde) { throw context.runtime.newErrnoEBADFError(); } catch (IOException ioe) { // hmmmm } return this; }
@JRubyMethod(name = "close_write") public IRubyObject close_write(ThreadContext context) { try { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getPipeStream() == null && myOpenFile.isReadable()) { throw context.runtime.newIOError("closing non-duplex IO for writing"); } if (myOpenFile.getPipeStream() == null) { close(); } else{ myOpenFile.getPipeStream().fclose(); myOpenFile.setPipeStream(null); myOpenFile.setMode(myOpenFile.getMode() & ~OpenFile.WRITABLE); // TODO // n is result of fclose; but perhaps having a SysError below is enough? // if (n != 0) rb_sys_fail(fptr->path); } } catch (BadDescriptorException bde) { throw context.runtime.newErrnoEBADFError(); } catch (IOException ioe) { // hmmmm } return this; }
@JRubyMethod(name = "close_read") public IRubyObject close_read(ThreadContext context) { Ruby runtime = context.runtime; try { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getPipeStream() == null && myOpenFile.isWritable()) { throw runtime.newIOError("closing non-duplex IO for reading"); } if (myOpenFile.getPipeStream() == null) { close(); } else{ myOpenFile.getMainStreamSafe().fclose(); myOpenFile.setMode(myOpenFile.getMode() & ~OpenFile.READABLE); myOpenFile.setMainStream(myOpenFile.getPipeStream()); myOpenFile.setPipeStream(null); // TODO // n is result of fclose; but perhaps having a SysError below is enough? // if (n != 0) rb_sys_fail(fptr->path); } } catch (BadDescriptorException bde) { throw runtime.newErrnoEBADFError(); } catch (IOException ioe) { // I believe Ruby bails out with a "bug" if closing fails throw runtime.newIOErrorFromException(ioe); } return this; }
@JRubyMethod(name = "close_read") public IRubyObject close_read(ThreadContext context) { Ruby runtime = context.runtime; try { OpenFile myOpenFile = getOpenFileChecked(); if (myOpenFile.getPipeStream() == null && myOpenFile.isWritable()) { throw runtime.newIOError("closing non-duplex IO for reading"); } if (myOpenFile.getPipeStream() == null) { close(); } else{ myOpenFile.getMainStreamSafe().fclose(); myOpenFile.setMode(myOpenFile.getMode() & ~OpenFile.READABLE); myOpenFile.setMainStream(myOpenFile.getPipeStream()); myOpenFile.setPipeStream(null); // TODO // n is result of fclose; but perhaps having a SysError below is enough? // if (n != 0) rb_sys_fail(fptr->path); } } catch (BadDescriptorException bde) { throw runtime.newErrnoEBADFError(); } catch (IOException ioe) { // I believe Ruby bails out with a "bug" if closing fails throw runtime.newIOErrorFromException(ioe); } return this; }
openFile.getPipeStream().fclose(); openFile.setPipeStream(null);
openFile.getPipeStream().fclose(); openFile.setPipeStream(null);
} else { Stream pipeFile = selfFile.getPipeStream(); selfStream.fclose(); selfFile.setPipeStream(null); selfFile.getPipeStream().fclose(); selfFile.setPipeStream(null); } else if (fd != origFile.getPipeStream().getDescriptor().getFileno()) { selfFile.getPipeStream().fclose(); ChannelDescriptor newFD2 = origFile.getPipeStream().getDescriptor().dup2(fd); selfFile.setPipeStream(ChannelStream.fdopen(runtime, newFD2, newIOOptions(runtime, "w").getModeFlags()));
} else { Stream pipeFile = selfFile.getPipeStream(); selfStream.fclose(); selfFile.setPipeStream(null); selfFile.getPipeStream().fclose(); selfFile.setPipeStream(null); } else if (fd != origFile.getPipeStream().getDescriptor().getFileno()) { selfFile.getPipeStream().fclose(); ChannelDescriptor newFD2 = origFile.getPipeStream().getDescriptor().dup2(fd); selfFile.setPipeStream(ChannelStream.fdopen(runtime, newFD2, newIOOptions(runtime, "w").getModeFlags()));