public void clearerr() { stream.clearerr(); }
public void clearerr() { stream.clearerr(); }
public void clearerr() { stream.clearerr(); }
public void clearerr() { stream.clearerr(); }
private RubyFixnum doSeek(ThreadContext context, long offset, int whence) { OpenFile myOpenFile = getOpenFileChecked(); try { myOpenFile.seek(offset, whence); myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException ex) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } return RubyFixnum.zero(context.runtime); }
private RubyFixnum doSeek(ThreadContext context, long offset, int whence) { OpenFile myOpenFile = getOpenFileChecked(); try { myOpenFile.seek(offset, whence); myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException ex) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } return RubyFixnum.zero(context.runtime); }
@JRubyMethod(name = "pos=", required = 1) public RubyFixnum pos_set(ThreadContext context, IRubyObject newPosition) { long offset = RubyNumeric.num2long(newPosition); if (offset < 0) { throw context.runtime.newSystemCallError("Negative seek offset"); } OpenFile myOpenFile = getOpenFileChecked(); try { myOpenFile.getMainStreamSafe().lseek(offset, Stream.SEEK_SET); myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } return context.runtime.newFixnum(offset); }
@JRubyMethod(name = "rewind") public RubyFixnum rewind(ThreadContext context) { OpenFile myOpenfile = getOpenFileChecked(); try { myOpenfile.getMainStreamSafe().lseek(0L, Stream.SEEK_SET); myOpenfile.getMainStreamSafe().clearerr(); // TODO: This is some goofy global file value from MRI..what to do? // if (io == current_file) { // gets_lineno -= fptr->lineno; // } } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } // Must be back on first line on rewind. myOpenfile.setLineNumber(0); return RubyFixnum.zero(context.runtime); }
@JRubyMethod(name = "rewind") public RubyFixnum rewind(ThreadContext context) { OpenFile myOpenfile = getOpenFileChecked(); try { myOpenfile.getMainStreamSafe().lseek(0L, Stream.SEEK_SET); myOpenfile.getMainStreamSafe().clearerr(); // TODO: This is some goofy global file value from MRI..what to do? // if (io == current_file) { // gets_lineno -= fptr->lineno; // } } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } // Must be back on first line on rewind. myOpenfile.setLineNumber(0); return RubyFixnum.zero(context.runtime); }
@JRubyMethod(name = "pos=", required = 1) public RubyFixnum pos_set(ThreadContext context, IRubyObject newPosition) { long offset = RubyNumeric.num2long(newPosition); if (offset < 0) { throw context.runtime.newSystemCallError("Negative seek offset"); } OpenFile myOpenFile = getOpenFileChecked(); try { myOpenFile.getMainStreamSafe().lseek(offset, Stream.SEEK_SET); myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (InvalidValueException e) { throw context.runtime.newErrnoEINVALError(); } catch (PipeException e) { throw context.runtime.newErrnoESPIPEError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } return context.runtime.newFixnum(offset); }
@JRubyMethod(name = "getc", compat = RUBY1_9) public IRubyObject getc19(ThreadContext context) { try { OpenFile myOpenFile = getOpenFileChecked(); myOpenFile.checkReadable(context.runtime); myOpenFile.setReadBuffered(); Stream stream = myOpenFile.getMainStreamSafe(); readCheck(stream); waitReadable(stream); stream.clearerr(); return ioGetc(context, stream); } catch (InvalidValueException ex) { throw context.runtime.newErrnoEINVALError(); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (EOFException e) { throw context.runtime.newEOFError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } }
@JRubyMethod(name = "getc", compat = RUBY1_9) public IRubyObject getc19(ThreadContext context) { try { OpenFile myOpenFile = getOpenFileChecked(); myOpenFile.checkReadable(context.runtime); myOpenFile.setReadBuffered(); Stream stream = myOpenFile.getMainStreamSafe(); readCheck(stream); waitReadable(stream); stream.clearerr(); return ioGetc(context, stream); } catch (InvalidValueException ex) { throw context.runtime.newErrnoEINVALError(); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } catch (EOFException e) { throw context.runtime.newEOFError(); } catch (IOException e) { throw context.runtime.newIOErrorFromException(e); } }
waitReadable(stream); openFile.checkClosed(getRuntime()); stream.clearerr(); ByteList newBuffer = blockingFRead(stream, thread, rest); if (newBuffer == null) {
public int getcCommon() { try { OpenFile myOpenFile = getOpenFileChecked(); myOpenFile.checkReadable(getRuntime()); myOpenFile.setReadBuffered(); Stream stream = myOpenFile.getMainStreamSafe(); readCheck(stream); waitReadable(stream); stream.clearerr(); return myOpenFile.getMainStreamSafe().fgetc(); } catch (InvalidValueException ex) { throw getRuntime().newErrnoEINVALError(); } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } catch (EOFException e) { throw getRuntime().newEOFError(); } catch (IOException e) { throw getRuntime().newIOErrorFromException(e); } }
public int getcCommon() { try { OpenFile myOpenFile = getOpenFileChecked(); myOpenFile.checkReadable(getRuntime()); myOpenFile.setReadBuffered(); Stream stream = myOpenFile.getMainStreamSafe(); readCheck(stream); waitReadable(stream); stream.clearerr(); return myOpenFile.getMainStreamSafe().fgetc(); } catch (InvalidValueException ex) { throw getRuntime().newErrnoEINVALError(); } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } catch (EOFException e) { throw getRuntime().newEOFError(); } catch (IOException e) { throw getRuntime().newIOErrorFromException(e); } }
do { readCheck(readStream); readStream.clearerr(); int n; try {
myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException ex) { throw context.runtime.newErrnoEBADFError();
myOpenFile.getMainStreamSafe().clearerr(); } catch (BadDescriptorException ex) { throw context.runtime.newErrnoEBADFError();