ntohl, ntohs, etc

J

JohnP

are there any classes in java.net or javax that provide the ntohx
functionality.


Thanks for your help


john
 
C

Chris Smith

JohnP said:
are there any classes in java.net or javax that provide the ntohx
functionality.

No, because it is not needed. There is no way to observe the host byte
order in Java, and all API functions that depend on byte ordering
specify which they use (generally network byte order). When you write
socket code, you'll typically write binary data using either a
java.io.DataOutputStream or some view of java.nio.ByteBuffer, and these
will give you the conversion you need.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
C

coltrane

thanks.
out of curiosity, is this documented in the spec or anywhere else?
thanks again for the help

john
 
C

coltrane

thanks.
out of curiosity, is this documented in the spec or anywhere else?
thanks again for the help

john
 
M

Michael Borgwardt

coltrane said:
thanks.
out of curiosity, is this documented in the spec or anywhere else?

It is documented in the API documentation for all methods that read or
write integer types, and also in the Java Virtual Machine Specification
where it is relevant to the class file format. I don't think it's
mentioned anywhere else in the JVMS or the JLS since it's not relevant
to the language itself.
 
T

Thomas Schodt

JohnP said:
are there any classes in java.net or javax that provide the ntohx
functionality.

If you are communicating with a legacy application that produces /
expects data in non-network format (norty), you may find
java.nio.ByteBuffer useful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top