---On Wed, 21 Apr 1999 13:54:02 -0700 (PDT), Jeffrey Radick said
> If a Java app exchanges data with data from a non-Java program
> then it must face platform-specific endianness issues.
> Does a program fail to be 100% Pure Java if it exchanges
> data with a non-Java program? (I'm asking, I'm uncertain
> of the definition of "100% Pure Java". But, I'd expect
> the answer is "no".)
>
>> *shrug*
>
I'm working on a '100% java' replacement for a program that communicates
with a SCO (intel) unix box. For historical reasons the data as a big
stream of ints, floats, strings, etc all little-endian (except the
strings, of course).
So, I created an class to deal with the data input (snippet follows).
Does this mean my app is not '100% java' ??
--re: Re: Big-Endians
Chris
#include <stddisclaimer.h>
Christopher R. Hawks
Software Engineer
Syscon Plantstar a
Division of Syscon International
[EMAIL PROTECTED]
Computers are like air-conditioners:
They stop working properly when you open windows.
Linux: The OS for people with an IQ over 98
***** Little Endian reader code snippet*********
(Data is read into buff via 'normal' means and read in a known order.
i.e. int-float-string(20)-byte-int-int-float ....)
private int pullInt() throws IOException
{
int t, i = 0, j;
for(j = 0; j < 4; j++)
{
t = buff[buffIdx++];
if(0 > t)
t += 0x100;
i |= t << (j * 8);
}
return i;
}
private float pullFloat() throws IOException
{
Float f = new Float(0);
return f.intBitsToFloat(pullInt());
}
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]