dcsimg
how to write a number to stream in big-endian format
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   bhaskar_kanduri
Posted On:   Monday, August 30, 2004 10:52 PM

how to write a number to stream in big-endian format

Re: how to write a number to stream in big-endian format

Posted By:   Benoit_Quintin  
Posted On:   Tuesday, August 31, 2004 07:28 AM

I'd suggest building a bit field, and then putting the result in a String (or char array), and then feed the String to your Stream.



A bit field if constructed with a bitwise & as in :

StringBuffer sbBigEndian;
int iTest = 139;
if(iTest & 2)
sbBigEndian.append("1");
else
sbBigEndian.append("0");
if(iTest & 4)
sbBigEndian.append("1");
else
sbBigEndian.append("0");
if(iTest & 8)
[rest cut for sake of brievity]

Anyways, something along those lines would probably work.
About | Sitemap | Contact