Karsten Meier wrote:
> Hello Ruby Fans
>
> I want to prepare some data so that a java program on a mobile phone
> can read them most easily. Currently my java program reads it char by
> char in a line oriented way. This works, but is slow on some phones,
> and also I need to handle newlines in the data in a special way.
> Now I like to create a file with "native java strings", in this case
> strings that can be read with DataInputStream.readUTF() method.
> I hope that this simplifies the code and improves the speed.

Can't you just use BufferedReader?  That's present since JDK 1.1 so I
assume it will be available on your phone.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html

> I don't need a complete Ruby/Java Integration, I just want to write
> these java strings to a file (or to stdout as a cgi-script).
> Are there any libraries for this?

That's standard functionality:

File.open("foo.txt", "w") do |io|
  io.puts "first line"
  io.print "second line\n"
end

As long as you stick with ASCII chars it's quite easy.  If you want to
write UTF8 or something it starts getting complicated.

Kind regards

    robert