How to pass file contents in ruby as inputstream to Java

My Java method is expecting DataInputstream as argument. I need to read
file contents in ruby and call that Java method with these contents.

contents =‘filename’)

How to convert contents (string) to inputstream?

Please help.

I would use something like


Hi, its not the same but i remenber to read about this and take this
solution to read a image resource from a jar and write it to a profile
dir. Basically i use a java class to read and other to content the
readed image. I think code that can solve your problem can look similar
to this.

class ConfigWebResources
def initialize
@web_resource1_name = Dir.home.to_s + “/.rmldonkey/log6.png”
if File.exists?(@web_resource1_name)
puts @web_resource1_name + " resource readed…"
is =
is ="/log6.png"))

puts @web_resource1_name + " resource write…"
end #if File.exists?(@web_resource1_name)
end #def configWebResources
end #class ConfigWebResources

Manuel R. Caro.
Coding on JRuby for fun.


El 13/03/14 21:30, Ravi Gudipati escribi??:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs