public void lseek(long offset, int type) throws IOException, InvalidValueException, PipeException, BadDescriptorException { stream.lseek(offset, type); }
public void lseek(long offset, int type) throws IOException, InvalidValueException, PipeException, BadDescriptorException { stream.lseek(offset, type); }
public void lseek(long offset, int type) throws IOException, InvalidValueException, PipeException, BadDescriptorException { stream.lseek(offset, type); }
public void lseek(long offset, int type) throws IOException, InvalidValueException, PipeException, BadDescriptorException { stream.lseek(offset, type); }
private void seekInternal(Stream stream, long offset, int whence) throws IOException, InvalidValueException, PipeException, BadDescriptorException { flushBeforeSeek(stream); stream.lseek(offset, whence); }
private void seekInternal(Stream stream, long offset, int whence) throws IOException, InvalidValueException, PipeException, BadDescriptorException { flushBeforeSeek(stream); stream.lseek(offset, whence); }
@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 = "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); }