forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava.io.rb
More file actions
31 lines (28 loc) · 722 Bytes
/
java.io.rb
File metadata and controls
31 lines (28 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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