Data Formats


Before peers can exchange data across the network, peers have a fundamental choice to make. They can exchange data in binary, ASCII, or structured data such as XML. The choice is an important one. How will you encode the information that is passed between peers, between services, and between components?

There are low-level issues, such as how different computer architectures represent and store integers and floating point numbers. In some systems, called big-endian architectures, the most significant part of the integer is stored in the first byte of a two-byte integer. On little-endian architectures, the convention is reversed.

Fortunately, if you are using Java, this distinction is not an issue you need to address directly. The Java virtual machine for a specific architecture provides a consistent low-level data representation. However, you will see references to little-endian and big-endian architecture as you delve into cross-platform interoperability. Care must be taken to encode information in a platform-neutral representation. As a result, text-based protocols tend to be the norm on the Internet. Most common protocols convert numbers to text, and use the resulting text representation in the data transfer. Of course, this results in larger messages, or heavy protocols on the wire. Despite this drawback, many systems are moving from traditional RPC mechanisms to text-based protocols.

There are instances where the data being exchanged can't be easily converted to text, such as music files or video files. In these cases, many systems are still converting the data from binary into ASCII representations for ease of use.

Chapter 8 will take a more in-depth look at data formats being used in P2P applications.



JavaT P2P Unleashed
JavaT P2P Unleashed
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net