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

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

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

Ruby.newErrnoEINVALError介绍

暂无

代码示例

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

private static void checkDirIsTwoSlashesOnWindows(Ruby runtime, String path) {
  if (Platform.IS_WINDOWS && ("//".equals(path) || "\\\\".equals(path))) {
    throw runtime.newErrnoEINVALError("Invalid argument - " + path);
  }
}

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

private static void checkDirIsTwoSlashesOnWindows(Ruby runtime, String path) {
  if (Platform.IS_WINDOWS && ("//".equals(path) || "\\\\".equals(path))) {
    throw runtime.newErrnoEINVALError("Invalid argument - " + path);
  }
}

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

public static int ioModestrFmode(Ruby runtime, String modesString) {
  try {
    return getFModeFromString(modesString);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError(modesString);
  }
}

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

public static int getOFlagsFromString(Ruby runtime, String modesString) {
  try {
    return getOFlagsFromString(modesString);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError("mode string: " + modesString);
  }
}

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

public static int getOFlagsFromString(Ruby runtime, String modesString) {
  try {
    return getOFlagsFromString(modesString);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError("mode string: " + modesString);
  }
}

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

public static ModeFlags newModeFlags(Ruby runtime, int mode) {
  try {
    return new ModeFlags(mode);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

public static int getOFlagsFromString(Ruby runtime, String modesString) {
  try {
    return getOFlagsFromString(modesString);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError("mode string: " + modesString);
  }
}

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

public static ModeFlags newModeFlags(Ruby runtime, int mode) {
  try {
    return new ModeFlags(mode);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

public static int getOFlagsFromString(Ruby runtime, String modesString) {
  try {
    return getOFlagsFromString(modesString);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError("mode string: " + modesString);
  }
}

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

public static ModeFlags newModeFlags(Ruby runtime, int mode) {
  try {
    return new ModeFlags(mode);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

public static IOOptions newIOOptions(Ruby runtime, int mode) {
  try {
    ModeFlags modeFlags = new ModeFlags(mode);
    return new IOOptions(modeFlags);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

public static IOOptions newIOOptions(Ruby runtime, int mode) {
  try {
    ModeFlags modeFlags = new ModeFlags(mode);
    return new IOOptions(modeFlags);
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  checkInitialized();
  int p = RubyNumeric.fix2int(arg);
  
  if (p < 0) throw getRuntime().newErrnoEINVALError(arg.toString());
  ptr.pos = p;
  return arg;
}

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

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  checkInitialized();
  int p = RubyNumeric.fix2int(arg);
  
  if (p < 0) throw getRuntime().newErrnoEINVALError(arg.toString());
  ptr.pos = p;
  return arg;
}

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

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  checkInitialized();
  long p = RubyNumeric.fix2long(arg);
  if (p < 0) throw getRuntime().newErrnoEINVALError(arg.toString());
  if (p > Integer.MAX_VALUE) throw getRuntime().newArgumentError("JRuby does not support StringIO larger than " + Integer.MAX_VALUE + " bytes");
  ptr.pos = (int)p;
  return arg;
}

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

public static IOOptions newIOOptions(Ruby runtime, IOOptions oldFlags, int orOflags) {
  try {
    return new IOOptions(new ModeFlags(oldFlags.getModeFlags().getFlags() | orOflags));
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

public static IOOptions newIOOptions(Ruby runtime, IOOptions oldFlags, int orOflags) {
  try {
    return new IOOptions(new ModeFlags(oldFlags.getModeFlags().getFlags() | orOflags));
  } catch (InvalidValueException ive) {
    throw runtime.newErrnoEINVALError();
  }
}

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

private static int stringAsNumber(IRubyObject val) {
  final Ruby runtime = val.getRuntime();
  ByteList str = val.convertToString().getByteList();
  IRubyObject res = Pack.unpack(runtime, str, FORMAT_SMALL_I).entry(0);
  if ( res.isNil() ) throw runtime.newErrnoEINVALError();
  return RubyNumeric.fix2int(res);
}

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

private int stringAsNumber(IRubyObject val) {
  ByteList str = val.convertToString().getByteList();
  IRubyObject res = Pack.unpack(getRuntime(), str, FORMAT_SMALL_I).entry(0);
  if (res.isNil()) {
    throw getRuntime().newErrnoEINVALError();
  }
  return RubyNumeric.fix2int(res);
}

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

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  ptr.pos = RubyNumeric.fix2int(arg);
  
  if (ptr.pos < 0) throw getRuntime().newErrnoEINVALError("Invalid argument");
  if (getRuntime().is1_8() && !isEndOfString()) ptr.eof = false;
  return getRuntime().getNil();
}

相关文章

Ruby类方法