Class: Java::java::net::URL

Inherits:
Object show all
Defined in:
core/src/main/ruby/jruby/java/java_ext/java.net.rb

Overview

Note:

Only explicit (or customized) Ruby methods are listed here, instances will have all of their Java methods available.

java.net.URL extensions.

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (IO) open(&block)

Open the URL stream and yield it as a Ruby `IO`.

Returns:

  • (IO)

    if no block given, otherwise yielded result



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'core/src/main/ruby/jruby/java/java_ext/java.net.rb', line 12

def open(&block)
  # stub implemented in org.jruby.javasupport.ext.JavaNet.java
  # stream = openStream
  # io = stream.to_io
  # if block
  #   begin
  #     block.call(io)
  #   ensure
  #     stream.close
  #   end
  # else
  #   io
  # end
end