tags:

views:

22

answers:

1

I have a Java method I want to call from JRuby. The argument I want to pass is just a normal string (org.jruby.RubyString), but the Java method is overloaded to take either:

  • java.io.InputStream
  • byte[]
  • com.google.protobuf.ByteString

What's an easy way I can convert my string to an instance of one of those classes?

A: 

Found it: org.jruby.RubyString#to_java_bytes.

rampion