1

I want to create an object from a Ruby program and store it in an SQL database as a blob. I then want to be able to read this blob directly into a Java program at a later date. I understand that these blobs will probably be incompatible. How can I go about making a Java-readable blob from Ruby?

3 Answers 3

2

You can use json (xml, yaml) format to store object as string. And parse it in java.

Sign up to request clarification or add additional context in comments.

4 Comments

How fast would this be for exceptionally large objects, though? Say ~100mb.
Don't know, try it. But I don't think there is good way to serialize native ruby object and deserialize it as java object. Even if it's possible, I doubt it would be fast.
It wouldn't be as fast as it would be without serializing/Deserializing. The best way is to benchmark it and see how it works for you.
OK, thanks. Accepting this answer as, although the other one provides helpful links, this one also answered my follow-up.
2
  1. Serialize ruby object to YAML (or JSON, XML etc)
  2. Save it in the DB
  3. Deserialize it from YAML to Java object

Comments

0

You should use thrift, it is much faster than (de)serializing json. See the benchmark here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.