Java and Endian-ness (was Re: PPC or i386 ?)

Geert Janssens yellowdog-general@lists.terrasoftsolutions.com
Thu Mar 11 09:54:02 2004


Thank you,

this explanation confirms my own reasoning. I didn't know the Java VM 
was big-endian though. Now I do !


Cheers,

Geert


Duke Robillard wrote:
> From: Clinton MacDonald <clint.macdonald@sbcglobal.net>
> Geert Janssens wrote:
> 
>  >> On a sidenote, I don't know Java enough to say whether or not endian
>  >> issues can still arise when writing java programs. I assume that these
>  >> issues should be dealt with in the runtime library for each specific
>  >> platform, and thus neither programmer, nor user should be concerned.
> 
>  >Though I am largely ignorant, I believe that Java programs are written
>  >for what is termed a "virtual machine." As such, the virtual machine is
>  >coded to appear to be identical on all platforms (though Microsoft has
>  >tried to work around that with their extensions to Java). Therefore, I
>  >assume the "endianess" taken into account.
> 
> The JVM (Java Virtual Machine) is big-endian.  So, binary data created
> by a JVM somewhere will be big-endian, no matter what machine the JVM
> was running on.  A JVM running on a PPC can read binary data created
> by a JVM running on an x86.  In that sense, Java handles the problem.
> 
> However, if you've got a Java program that wants to read binary data
> created by a C program, you've still got the old "endian" worries.
> 
> I expected to find a class in the Java IO streams stuff to convert
> little endian data into Java compatible big endian, but I didn't.
> It's pretty easy to write, but I'm surpised it's not in Sun's java.io.*
> package.
> 
> Duke
> 
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> HINT: to Google archives, try  '<keywords> site:terrasoftsolutions.com'
> 
> 
>