All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jruby.java.java_ext.java.io.rb Maven / Gradle / Ivy

There is a newer version: 9.4.9.0
Show newest version
require 'jruby' unless defined? JRuby

class java::io::InputStream
  def to_io(opts = nil)
    ruby_io = org.jruby.RubyIO.new(JRuby.runtime, self)
    if opts && !opts[:autoclose]
      ruby_io.setAutoclose(false)
    end
    JRuby.dereference(ruby_io)
  end
end

class java::io::OutputStream
  def to_io(opts = nil)
    ruby_io = org.jruby.RubyIO.new(JRuby.runtime, self)
    if opts && !opts[:autoclose]
      ruby_io.setAutoclose(false)
    end
    JRuby.dereference(ruby_io)
  end
end

module java::nio::channels::Channel
  def to_io(opts = nil)
    ruby_io = org.jruby.RubyIO.new(JRuby.runtime, self)
    if opts && !opts[:autoclose]
      ruby_io.setAutoclose(false)
    end
    JRuby.dereference(ruby_io)
  end
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy