本文整理了Java中org.jruby.Ruby.setDefaultExternalEncoding
方法的一些代码示例,展示了Ruby.setDefaultExternalEncoding
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.setDefaultExternalEncoding
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:setDefaultExternalEncoding
暂无
代码示例来源:origin: org.jruby/jruby-complete
public static void rbEncSetDefaultExternal(ThreadContext context, IRubyObject encoding) {
if (encoding.isNil()) {
throw context.runtime.newArgumentError("default external can not be nil");
}
Encoding[] enc_p = {context.runtime.getDefaultExternalEncoding()};
encSetDefaultEncoding(context, enc_p, encoding, "external");
context.runtime.setDefaultExternalEncoding(enc_p[0]);
}
代码示例来源:origin: org.jruby/jruby-core
public static void rbEncSetDefaultExternal(ThreadContext context, IRubyObject encoding) {
if (encoding.isNil()) {
throw context.runtime.newArgumentError("default external can not be nil");
}
Encoding[] enc_p = {context.runtime.getDefaultExternalEncoding()};
encSetDefaultEncoding(context, enc_p, encoding, "external");
context.runtime.setDefaultExternalEncoding(enc_p[0]);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static void rbEncSetDefaultExternal(ThreadContext context, IRubyObject encoding) {
if (encoding.isNil()) {
throw context.runtime.newArgumentError("default external can not be nil");
}
Encoding[] enc_p = {context.runtime.getDefaultExternalEncoding()};
encSetDefaultEncoding(context, enc_p, encoding, "external");
context.runtime.setDefaultExternalEncoding(enc_p[0]);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static void rbEncSetDefaultExternal(ThreadContext context, IRubyObject encoding) {
if (encoding.isNil()) {
throw context.runtime.newArgumentError("default external can not be nil");
}
Encoding[] enc_p = {context.runtime.getDefaultExternalEncoding()};
encSetDefaultEncoding(context, enc_p, encoding, "external");
context.runtime.setDefaultExternalEncoding(enc_p[0]);
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject getDefaultExternal() {
Encoding defaultEncoding = runtime.getDefaultExternalEncoding();
if (defaultEncoding == null) {
// TODO: MRI seems to default blindly to US-ASCII and we were using Charset default from Java...which is right?
ByteList encodingName = ByteList.create("US-ASCII");
defaultEncoding = runtime.getEncodingService().loadEncoding(encodingName);
runtime.setDefaultExternalEncoding(defaultEncoding);
}
return getEncoding(defaultEncoding);
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject getDefaultExternal() {
Encoding defaultEncoding = runtime.getDefaultExternalEncoding();
if (defaultEncoding == null) {
// TODO: MRI seems to default blindly to US-ASCII and we were using Charset default from Java...which is right?
ByteList encodingName = ByteList.create("US-ASCII");
defaultEncoding = runtime.getEncodingService().loadEncoding(encodingName);
runtime.setDefaultExternalEncoding(defaultEncoding);
}
return getEncoding(defaultEncoding);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject getDefaultExternal() {
IRubyObject defaultExternal = convertEncodingToRubyEncoding(runtime.getDefaultExternalEncoding());
if (defaultExternal.isNil()) {
// TODO: MRI seems to default blindly to US-ASCII and we were using Charset default from Java...which is right?
ByteList encodingName = ByteList.create("US-ASCII");
Encoding encoding = runtime.getEncodingService().loadEncoding(encodingName);
runtime.setDefaultExternalEncoding(encoding);
defaultExternal = convertEncodingToRubyEncoding(encoding);
}
return defaultExternal;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public IRubyObject getDefaultExternal() {
IRubyObject defaultExternal = convertEncodingToRubyEncoding(runtime.getDefaultExternalEncoding());
if (defaultExternal.isNil()) {
// TODO: MRI seems to default blindly to US-ASCII and we were using Charset default from Java...which is right?
ByteList encodingName = ByteList.create("US-ASCII");
Encoding encoding = runtime.getEncodingService().loadEncoding(encodingName);
runtime.setDefaultExternalEncoding(encoding);
defaultExternal = convertEncodingToRubyEncoding(encoding);
}
return defaultExternal;
}
代码示例来源:origin: org.jruby/jruby-complete
Encoding loadedEncoding = encodingService.loadEncoding(ByteList.create(encoding));
if (loadedEncoding == null) throw new MainExitException(1, "unknown encoding name - " + encoding);
setDefaultExternalEncoding(loadedEncoding);
} else {
Encoding consoleEncoding = encodingService.getConsoleEncoding();
Encoding availableEncoding = consoleEncoding == null ? encodingService.getLocaleEncoding() : consoleEncoding;
setDefaultExternalEncoding(availableEncoding);
代码示例来源:origin: org.jruby/jruby-core
Encoding loadedEncoding = encodingService.loadEncoding(ByteList.create(encoding));
if (loadedEncoding == null) throw new MainExitException(1, "unknown encoding name - " + encoding);
setDefaultExternalEncoding(loadedEncoding);
} else {
Encoding consoleEncoding = encodingService.getConsoleEncoding();
Encoding availableEncoding = consoleEncoding == null ? encodingService.getLocaleEncoding() : consoleEncoding;
setDefaultExternalEncoding(availableEncoding);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
Encoding loadedEncoding = encodingService.loadEncoding(ByteList.create(encoding));
if (loadedEncoding == null) throw new MainExitException(1, "unknown encoding name - " + encoding);
setDefaultExternalEncoding(loadedEncoding);
} else {
Encoding consoleEncoding = encodingService.getConsoleEncoding();
Encoding availableEncoding = consoleEncoding == null ? encodingService.getLocaleEncoding() : consoleEncoding;
setDefaultExternalEncoding(availableEncoding);
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
Encoding loadedEncoding = encodingService.loadEncoding(ByteList.create(encoding));
if (loadedEncoding == null) throw new MainExitException(1, "unknown encoding name - " + encoding);
setDefaultExternalEncoding(loadedEncoding);
} else {
Encoding consoleEncoding = encodingService.getConsoleEncoding();
Encoding availableEncoding = consoleEncoding == null ? encodingService.getLocaleEncoding() : consoleEncoding;
setDefaultExternalEncoding(availableEncoding);
内容来源于网络,如有侵权,请联系作者删除!