0

I want to convert XML into binary data in Java? What is the fastest and easiest way to do this?

Is there any internal Java method that I can use?

6
  • This is not clear; you need to describe what type of binary file you're thinking of. Commented Jun 13, 2012 at 16:50
  • For example Base64? What kind of binary data do you know? Commented Jun 13, 2012 at 16:53
  • @user1285928: Maybe it would be clearer if you describe the goal here. What do you want to use this binary file for? Commented Jun 13, 2012 at 17:01
  • Here is the idea: I want to create XML data, convert it into binary data and send it to another computer on the network. Commented Jun 13, 2012 at 17:03
  • @user1285928: Why don't you just send the XML? Commented Jun 14, 2012 at 0:21

1 Answer 1

1

If you want to just compress the xml then you can read it and use either GZIPOutputStream or ZipOutputstream as described here.

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

3 Comments

Which is format will be more efficient - binary xml or compressed XML?
Compression is a way of expressing the same data in a fewer number of bits.
binary XML is 95% effective on XML structure, so probably binary XML.

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.