> ---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".)

Chris Hawks writes:

> 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' ??

The original claim was that no 100% pure Java app can determine the
endianness of the machine it is running on.  In other words, no 100%
pure Java app will produce different output on a big-endian machine
than it does on a little-endian machine.  That claim is correct.

Java I/O is independent of the endianness of the *hardware it is
running on.*  Chris, you can ftp your SCO data file to a (big-endian)
SPARC and run your Java program, and you will get exactly the same
output as if you ran your Java program on a (little-endian) Pentium.

Obviously no I/O, Java's or anyone else's, can be independent of the
endianness of the *data file* -- any more than I/O can be independent
of the size or order of the fields.

People are confused because little-endian data files are (were) seldom
found on big-endian systems and vice-versa.  But once you give
little-endian and big-endian machines access to the same file server
(as many people do nowadays), then the distinction between data file
endianness and processor endianness ceases to be such a mystery.  In
such a heterogenous environment, it's wonderful to write one Java
program that accesses the same data files in the same way -- without
having to take any precautions to ensure identical behavior between
big-endian and little-endian hardware.

Best,
daniel dulitz

Valley Technologies, Inc.               Peak Performance Real-Time DSP
State College, PA


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to