For Programmers: Free Programming Magazines  


Home > Archive > Java Help > August 2007 > Re: How to convert int/float etc into byte?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to convert int/float etc into byte?
Roedy Green

2007-08-24, 7:18 pm

On Fri, 24 Aug 2007 15:13:19 -0400, RC <raymond.chui@nospam.noaa.gov>
wrote, quoted or indirectly quoted someone who said :

>I want to write all these into a binary file.


there are a number of techniques.

1. DataOutputStream.
see http://mindprod.com/applet/fileio.html for sample code.

2. LEDataOutputStream (for little endian).
See http://mindprod.com/applet/fileio.html for sample code.

3. Nio. See http://mindprod.com/jgloss/nio.html

4. serialised objects.
see http://mindprod.com/jgloss/serialization.html

5. Double.doubleToLongBits.
see http://mindprod.com/jgloss/jgloss/floatingpoint.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com