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

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

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

Ruby.newIOError介绍

[英]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

public void checkClosed() {
  if (fd == null) {
    throw runtime.newIOError(RubyIO.CLOSED_STREAM_MSG);
  }
}

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

public void checkClosed() {
  if (fd == null) {
    throw runtime.newIOError(RubyIO.CLOSED_STREAM_MSG);
  }
}

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

private void checkFinalized() {
  if (ptr.string == null) {
    throw getRuntime().newIOError("not opened");
  }
}

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

private void checkInitialized() {
  if (openFile == null) {
    throw getRuntime().newIOError("uninitialized stream");
  }
}

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

private void checkFinalized() {
  if (ptr.string == null) {
    throw getRuntime().newIOError("not opened");
  }
}

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

private void checkInitialized() {
  if (ptr == null) {
    throw getRuntime().newIOError("uninitialized stream");
  }
}

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

@Override
protected IRubyObject rbIoClose(ThreadContext context) {
  // Make sure any existing lock is released before we try and close the file
  if (openFile.currentLock != null) {
    try {
      openFile.currentLock.release();
    } catch (IOException e) {
      throw context.runtime.newIOError(e.getMessage());
    }
  }
  return super.rbIoClose(context);
}

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

/**
 * 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?
 */
public static RaiseException newIOErrorFromException(Ruby runtime, IOException ex) {
  Errno errno = errnoFromException(ex);
  if (errno == null) throw runtime.newIOError(ex.getLocalizedMessage());
  throw runtime.newErrnoFromErrno(errno, ex.getLocalizedMessage());
}

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

private void checkOpen() {
    if (closed()) {
      throw getRuntime().newIOError(RubyIO.CLOSED_STREAM_MSG);
    }
  }
}

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

@JRubyMethod
public IRubyObject close_read(ThreadContext context) {
  // ~ checkReadable() :
  checkInitialized();
  if ( (ptr.flags & OpenFile.READABLE) == 0 ) {
    throw context.runtime.newIOError("not opened for reading");
  }
  if ( ( flags & STRIO_READABLE ) != 0 ) {
    flags &= ~STRIO_READABLE;
  }
  return context.nil;
}

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

private void checkOpen() {
    if (closed()) {
      throw getRuntime().newIOError(RubyIO.CLOSED_STREAM_MSG);
    }
  }
}

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

public void checkByteReadable(ThreadContext context) {
  checkCharReadable(context);
  if (READ_CHAR_PENDING()) {
    throw runtime.newIOError("byte oriented read for character buffered IO");
  }
}

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

@JRubyMethod
public IRubyObject close_write(ThreadContext context) {
  // ~ checkWritable() :
  checkInitialized();
  if ( (ptr.flags & OpenFile.WRITABLE) == 0 ) {
    throw context.runtime.newIOError("not opened for writing");
  }
  if ( ( flags & STRIO_WRITABLE ) != 0 ) {
    flags &= ~STRIO_WRITABLE;
  }
  return context.nil;
}

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

private void checkOpen() {
    if (closed()) {
      throw getRuntime().newIOError("closed stream");
    }
  }
}

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

public void checkByteReadable(ThreadContext context) {
  checkCharReadable(context);
  if (READ_CHAR_PENDING()) {
    throw runtime.newIOError("byte oriented read for character buffered IO");
  }
}

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

@JRubyMethod
public IRubyObject close_read(ThreadContext context) {
  // ~ checkReadable() :
  checkInitialized();
  if ( (ptr.flags & OpenFile.READABLE) == 0 ) {
    throw context.runtime.newIOError("not opened for reading");
  }
  if ( ( flags & STRIO_READABLE ) != 0 ) {
    flags &= ~STRIO_READABLE;
  }
  return context.nil;
}

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

private void checkWritable() {
  checkInitialized();
  if (!writable()) {
    throw getRuntime().newIOError("not opened for writing");
  }
  // Tainting here if we ever want it. (secure 4)
}

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

private final void checkDir() {
  testFrozen("Dir");
  update();
  if (!isOpen) throw getRuntime().newIOError("closed directory");
}

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

private void checkReadable() {
  checkInitialized();
  if (!readable()) {
    throw getRuntime().newIOError("not opened for reading");
  }
}

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

private void checkReadable() {
  checkInitialized();
  if (!readable()) {
    throw getRuntime().newIOError("not opened for reading");
  }
}

相关文章

Ruby类方法