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

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

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

Ruby.newIOErrorFromException介绍

[英]Java does not give us enough information for specific error conditions so we are reduced to divining them through string matches... TODO: Should ECONNABORTED get thrown earlier in the descriptor itself or is it ok to handle this late? TODO: Should we include this into Errno code somewhere do we can use this from other places as well?
[中]Java没有为我们提供足够的特定错误条件的信息,所以我们只能通过字符串匹配来预测它们。。。TODO:ECONNABORTED应该在描述符本身中更早地抛出,还是可以晚一点处理?TODO:我们是否应该将其包含在Errno代码中?我们是否也可以从其他地方使用它?

代码示例

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name="close")
public IRubyObject close() {
  try {
    impl.close();
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
  return this;
}

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

@JRubyMethod(name="close")
public IRubyObject close() {
  try {
    impl.close();
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
  return this;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name="close")
public IRubyObject close() {
  try {
    impl.close();
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
  return this;
}

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

@JRubyMethod(name="close")
public IRubyObject close() {
  try {
    impl.close();
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
  return this;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "putc", required = 1)
public IRubyObject putc(IRubyObject p1) {
  try {
    io.write(RubyNumeric.num2chr(p1));
    
    return p1;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

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

@JRubyMethod(name = "putc", required = 1)
public IRubyObject putc(IRubyObject p1) {
  try {
    io.write(RubyNumeric.num2chr(p1));
    
    return p1;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

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

@JRubyMethod(name = "putc", required = 1)
public IRubyObject putc(IRubyObject p1) {
  try {
    io.write(RubyNumeric.num2chr(p1));
    
    return p1;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "putc", required = 1)
public IRubyObject putc(IRubyObject p1) {
  try {
    io.write(RubyNumeric.num2chr(p1));
    
    return p1;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

代码示例来源:origin: square/rack-servlet

@JRubyMethod public IRubyObject gets() {
 try {
  return toRubyString(rackInput.gets());
 } catch (IOException e) {
  throw getRuntime().newIOErrorFromException(e);
 }
}

代码示例来源:origin: com.squareup.rack/rack-servlet

@JRubyMethod public IRubyObject gets() {
 try {
  return toRubyString(rackInput.gets());
 } catch (IOException e) {
  throw getRuntime().newIOErrorFromException(e);
 }
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "getbyte")
public IRubyObject getc() {
  try {
    int value = bufferedStream.read();
    if (value == -1) return getRuntime().getNil();
    position++;
    return getRuntime().newFixnum(value);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "gets", optional = 2, writes = FrameField.LASTLINE)
public IRubyObject gets(ThreadContext context, IRubyObject[] args) {
  try {
    IRubyObject result = internalGets(args);
    if (!result.isNil()) context.setLastLine(result);
    
    return result;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}
private final static int BUFF_SIZE = 4096;

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "readchar")
public IRubyObject readchar() {
  try {
    int value = bufferedStream.read();
    if (value == -1) throw getRuntime().newEOFError();
    position++;
    
    return getRuntime().newFixnum(value);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

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

@JRubyMethod(name = "readchar")
public IRubyObject readchar() {
  try {
    int value = bufferedStream.read();
    if (value == -1) throw getRuntime().newEOFError();
    position++;
    
    return getRuntime().newFixnum(value);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "gets", optional = 2, writes = FrameField.LASTLINE)
public IRubyObject gets(ThreadContext context, IRubyObject[] args) {
  try {
    IRubyObject result = internalGets(args);
    if (!result.isNil()) context.setLastLine(result);
    
    return result;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}
private final static int BUFF_SIZE = 4096;

代码示例来源:origin: com.squareup.rack/rack-servlet

@JRubyMethod(optional = 1) public IRubyObject read(ThreadContext context, IRubyObject[] args) {
 Integer length = null;
 if (args.length > 0) {
  long arg = args[0].convertToInteger("to_i").getLongValue();
  length = (int) Math.min(arg, Integer.MAX_VALUE);
 }
 try {
  return toRubyString(rackInput.read(length));
 } catch (IOException e) {
  throw getRuntime().newIOErrorFromException(e);
 }
}

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

@JRubyMethod(name = "gets", optional = 2, writes = FrameField.LASTLINE, compat = RUBY1_9)
public IRubyObject gets(ThreadContext context, IRubyObject[] args) {
  try {
    IRubyObject result = internalGets(args);
    if (!result.isNil()) context.setLastLine(result);
    
    return result;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}
private final static int BUFF_SIZE = 4096;

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name="initialize",required=1, visibility = Visibility.PRIVATE)
public IRubyObject initialize(IRubyObject wrappedStream) {
  InputStream stream = (InputStream) wrappedStream.toJava(InputStream.class);
  try {
    impl = new JRubyObjectInputStreamImpl(getRuntime(), stream);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
  return this;
}

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

@JRubyMethod(name = "gets", optional = 2, writes = FrameField.LASTLINE, compat = RUBY1_9)
public IRubyObject gets(ThreadContext context, IRubyObject[] args) {
  try {
    IRubyObject result = internalGets(args);
    if (!result.isNil()) context.setLastLine(result);
    
    return result;
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}
private final static int BUFF_SIZE = 4096;

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

@JRubyMethod(name = {"getc", "getbyte"}, compat = RUBY1_8)
public IRubyObject getc() {
  try {
    int value = bufferedStream.read();
    if (value == -1) return getRuntime().getNil();
    position++;
    
    return getRuntime().newFixnum(value);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法