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

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

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

Ruby.getOut介绍

暂无

代码示例

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

  1. private void pumpInput(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = ChannelHelper.unwrapBufferedStream(child.getInputStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = ChannelHelper.unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inputPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inputPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inputPumper.start();
  19. input = null;
  20. inputChannel = null;
  21. }

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

  1. private void pumpInput(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = unwrapBufferedStream(child.getInputStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inputPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inputPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inputPumper.start();
  19. input = null;
  20. inputChannel = null;
  21. }

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

  1. private void pumpInerr(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = ChannelHelper.unwrapBufferedStream(child.getErrorStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = ChannelHelper.unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inerrPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inerrPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inerrPumper.start();
  19. inerr = null;
  20. inerrChannel = null;
  21. }
  22. }

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

  1. private void pumpInput(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = ChannelHelper.unwrapBufferedStream(child.getInputStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = ChannelHelper.unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inputPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inputPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inputPumper.start();
  19. input = null;
  20. inputChannel = null;
  21. }

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

  1. private void pumpInput(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = unwrapBufferedStream(child.getInputStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inputPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inputPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inputPumper.start();
  19. input = null;
  20. inputChannel = null;
  21. }

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

  1. @Override
  2. public void report(ProfileCollection collector) {
  3. if(!(collector instanceof ProfileData))
  4. throw new IllegalArgumentException( "Given collector must be an instance of " + ProfileData.class.getName() + "." );
  5. RubyInstanceConfig config = getConfig();
  6. ProfileData profileData = (ProfileData) collector;
  7. ProfileOutput output = config.getProfileOutput();
  8. ProfilePrinter profilePrinter = ProfilePrinter.newPrinter( config.getProfilingMode(), profileData );
  9. if (profilePrinter != null) {
  10. output.printProfile(profilePrinter);
  11. } else {
  12. getRuntime().getOut().println("\nno printer for profile mode: " + config.getProfilingMode() + " !");
  13. }
  14. }

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

  1. private void pumpInerr(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = ChannelHelper.unwrapBufferedStream(child.getErrorStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = ChannelHelper.unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inerrPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inerrPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inerrPumper.start();
  19. inerr = null;
  20. inerrChannel = null;
  21. }
  22. }

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

  1. @Override
  2. public void report(ProfileCollection collector) {
  3. if(!(collector instanceof ProfileData))
  4. throw new IllegalArgumentException( "Given collector must be an instance of " + ProfileData.class.getName() + "." );
  5. RubyInstanceConfig config = getConfig();
  6. ProfileData profileData = (ProfileData) collector;
  7. ProfileOutput output = config.getProfileOutput();
  8. ProfilePrinter profilePrinter = ProfilePrinter.newPrinter( config.getProfilingMode(), profileData );
  9. if (profilePrinter != null) {
  10. output.printProfile(profilePrinter);
  11. } else {
  12. getRuntime().getOut().println("\nno printer for profile mode: " + config.getProfilingMode() + " !");
  13. }
  14. }

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

  1. private void pumpInerr(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = unwrapBufferedStream(child.getErrorStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inerrPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inerrPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inerrPumper.start();
  19. inerr = null;
  20. inerrChannel = null;
  21. }
  22. }

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

  1. private void pumpInerr(Process child, Ruby runtime) {
  2. // no read requested, hook up read to parents output
  3. InputStream childIn = unwrapBufferedStream(child.getErrorStream());
  4. FileChannel childInChannel = null;
  5. if (childIn instanceof FileInputStream) {
  6. childInChannel = ((FileInputStream) childIn).getChannel();
  7. }
  8. OutputStream parentOut = unwrapBufferedStream(runtime.getOut());
  9. FileChannel parentOutChannel = null;
  10. if (parentOut instanceof FileOutputStream) {
  11. parentOutChannel = ((FileOutputStream) parentOut).getChannel();
  12. }
  13. if (childInChannel != null && parentOutChannel != null) {
  14. inerrPumper = new ChannelPumper(runtime, childInChannel, parentOutChannel, Pumper.Slave.IN, this);
  15. } else {
  16. inerrPumper = new StreamPumper(runtime, childIn, parentOut, false, Pumper.Slave.IN, this);
  17. }
  18. inerrPumper.start();
  19. inerr = null;
  20. inerrChannel = null;
  21. }
  22. }

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

  1. @Deprecated
  2. public RubyIO(Ruby runtime, STDIO stdio) {
  3. super(runtime, runtime.getIO());
  4. RubyIO tmp = null;
  5. switch (stdio) {
  6. case IN:
  7. tmp = prepStdio(runtime, runtime.getIn(), Channels.newChannel(runtime.getIn()), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  8. break;
  9. case OUT:
  10. tmp = prepStdio(runtime, runtime.getOut(), Channels.newChannel(runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  11. break;
  12. case ERR:
  13. tmp = prepStdio(runtime, runtime.getErr(), Channels.newChannel(runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
  14. break;
  15. }
  16. this.openFile = tmp.openFile;
  17. tmp.openFile = null;
  18. }

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

  1. @Deprecated
  2. public RubyIO(Ruby runtime, STDIO stdio) {
  3. super(runtime, runtime.getIO());
  4. RubyIO tmp = null;
  5. switch (stdio) {
  6. case IN:
  7. tmp = prepStdio(runtime, runtime.getIn(), Channels.newChannel(runtime.getIn()), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  8. break;
  9. case OUT:
  10. tmp = prepStdio(runtime, runtime.getOut(), Channels.newChannel(runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  11. break;
  12. case ERR:
  13. tmp = prepStdio(runtime, runtime.getErr(), Channels.newChannel(runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
  14. break;
  15. }
  16. this.openFile = tmp.openFile;
  17. tmp.openFile = null;
  18. }

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

  1. @SuppressWarnings("unchecked")
  2. void doInitialize(final Ruby runtime) {
  3. setOut( runtime.getOut() );
  4. setErr( runtime.getErr() );
  5. rubyENV = runtime.getENV();
  6. compatVersion = runtime.getInstanceConfig().getCompatVersion();
  7. }

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

  1. break;
  2. case 1:
  3. fd = new ChannelFD(Channels.newChannel(runtime.getOut()), runtime.getPosix(), runtime.getFilenoUtil());
  4. break;
  5. case 2:

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

  1. break;
  2. case 1:
  3. fd = new ChannelFD(Channels.newChannel(runtime.getOut()), runtime.getPosix(), runtime.getFilenoUtil());
  4. break;
  5. case 2:

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

  1. break;
  2. case OUT:
  3. descriptor = new ChannelDescriptor(Channels.newChannel(runtime.getOut()), newModeFlags(runtime, ModeFlags.WRONLY | ModeFlags.APPEND), FileDescriptor.out);
  4. runtime.putFilenoMap(1, descriptor.getFileno());
  5. mainStream = ChannelStream.open(runtime, descriptor);

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

  1. break;
  2. case OUT:
  3. descriptor = new ChannelDescriptor(Channels.newChannel(runtime.getOut()), newModeFlags(runtime, ModeFlags.WRONLY | ModeFlags.APPEND), FileDescriptor.out);
  4. runtime.putFilenoMap(1, descriptor.getFileno());
  5. mainStream = ChannelStream.open(runtime, descriptor);

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

  1. runtime, runtime.getIn(), new NativeDeviceChannel(0), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  2. stdout = RubyIO.prepStdio(
  3. runtime, runtime.getOut(), new NativeDeviceChannel(1), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  4. stderr = RubyIO.prepStdio(
  5. runtime, runtime.getErr(), new NativeDeviceChannel(2), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
  6. runtime, runtime.getIn(), prepareStdioChannel(runtime, STDIO.IN, runtime.getIn()), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  7. stdout = RubyIO.prepStdio(
  8. runtime, runtime.getOut(), prepareStdioChannel(runtime, STDIO.OUT, runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  9. stderr = RubyIO.prepStdio(
  10. runtime, runtime.getErr(), prepareStdioChannel(runtime, STDIO.ERR, runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");

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

  1. runtime, runtime.getIn(), new NativeDeviceChannel(0), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  2. stdout = RubyIO.prepStdio(
  3. runtime, runtime.getOut(), new NativeDeviceChannel(1), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  4. stderr = RubyIO.prepStdio(
  5. runtime, runtime.getErr(), new NativeDeviceChannel(2), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
  6. runtime, runtime.getIn(), prepareStdioChannel(runtime, STDIO.IN, runtime.getIn()), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
  7. stdout = RubyIO.prepStdio(
  8. runtime, runtime.getOut(), prepareStdioChannel(runtime, STDIO.OUT, runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
  9. stderr = RubyIO.prepStdio(
  10. runtime, runtime.getErr(), prepareStdioChannel(runtime, STDIO.ERR, runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");

相关文章

Ruby类方法