org.jruby.Ruby.newErrnoESPIPEError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.jruby.Ruby.newErrnoESPIPEError方法的一些代码示例,展示了Ruby.newErrnoESPIPEError的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoESPIPEError方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoESPIPEError

Ruby.newErrnoESPIPEError介绍

暂无

代码示例

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"pos", "tell"})
public RubyFixnum pos(ThreadContext context) {
  try {
    return context.runtime.newFixnum(getOpenFileChecked().getMainStreamSafe().fgetpos());
  } catch (InvalidValueException ex) {
    throw context.runtime.newErrnoEINVALError();
  } catch (BadDescriptorException bde) {
    throw context.runtime.newErrnoEBADFError();
  } catch (PipeException e) {
    throw context.runtime.newErrnoESPIPEError();
  } catch (IOException e) {
    throw context.runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"pos", "tell"})
public RubyFixnum pos(ThreadContext context) {
  try {
    return context.runtime.newFixnum(getOpenFileChecked().getMainStreamSafe().fgetpos());
  } catch (InvalidValueException ex) {
    throw context.runtime.newErrnoEINVALError();
  } catch (BadDescriptorException bde) {
    throw context.runtime.newErrnoEBADFError();
  } catch (PipeException e) {
    throw context.runtime.newErrnoESPIPEError();
  } catch (IOException e) {
    throw context.runtime.newIOErrorFromException(e);
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

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);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(required = 1)
public IRubyObject truncate(ThreadContext context, IRubyObject arg) {
  RubyInteger newLength = arg.convertToInteger();
  if (newLength.getLongValue() < 0) {
    throw context.runtime.newErrnoEINVALError(path);
  }
  try {
    openFile.checkWritable(context.runtime);
    openFile.getMainStreamSafe().ftruncate(newLength.getLongValue());
  } catch (BadDescriptorException e) {
    throw context.runtime.newErrnoEBADFError();
  } catch (PipeException e) {
    throw context.runtime.newErrnoESPIPEError();
  } catch (InvalidValueException ex) {
    throw context.runtime.newErrnoEINVALError();
  } catch (IOException e) {
    // Should we do anything?
  }
  return RubyFixnum.zero(context.runtime);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(required = 1)
public IRubyObject truncate(ThreadContext context, IRubyObject arg) {
  RubyInteger newLength = arg.convertToInteger();
  if (newLength.getLongValue() < 0) {
    throw context.runtime.newErrnoEINVALError(path);
  }
  try {
    openFile.checkWritable(context.runtime);
    openFile.getMainStreamSafe().ftruncate(newLength.getLongValue());
  } catch (BadDescriptorException e) {
    throw context.runtime.newErrnoEBADFError();
  } catch (PipeException e) {
    throw context.runtime.newErrnoESPIPEError();
  } catch (InvalidValueException ex) {
    throw context.runtime.newErrnoEINVALError();
  } catch (IOException e) {
    // Should we do anything?
  }
  return RubyFixnum.zero(context.runtime);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@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);
  }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@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);
  }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@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);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@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);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

throw context.runtime.newErrnoEINVALError();
} catch (PipeException e) {
  throw context.runtime.newErrnoESPIPEError();
} catch (IOException e) {
  throw context.runtime.newIOErrorFromException(e);

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

throw context.runtime.newErrnoEINVALError();
} catch (PipeException e) {
  throw context.runtime.newErrnoESPIPEError();
} catch (IOException e) {
  throw context.runtime.newIOErrorFromException(e);

相关文章

Ruby类方法