Protocol Buffers

Use Protocol Buffers Instead of JSON for Internal services

Protocol Buffers is a method of serializing structured data. It is useful in developing programs to communicate with each other over a wire or for storing data. The design goals for Protocol Buffers emphasized simplicity and performance. In particular, it was designed to be smaller and faster than XML. Protocol Buffers offer several compelling advantages over JSON for sending data over the wire between internal services.

Protocol Buffers is widely used at Google for storing and interchanging all kinds of structured information. The method serves as a basis for a custom remote procedure call (RPC) system that is used for nearly all inter-machine communication at Google. 

Download Source from here
Download protobuf jar here.

Protobuf vs XML
Protocol buffers are 20 to 100 times faster (in nanoseconds) than XML.

Protobuf vs JSON
Protocol buffers are 50%+ more efficient in terms of storage compare to JSON and faster.

Input
Enter person ID: 1
Enter name: AbdulJeilani
Enter email address (blank for none): abdul.professional@gmail.com
Enter a phone number (or leave blank to finish): 0123456789
Is this a mobile, home, or work phone? mobile
Enter a phone number (or leave blank to finish): 

Output
Person ID: 1
 Name: AbdulJeilani
 E-mail address: abdul.professional@gmail.com
 Mobile phone #: 0123456789

User data stored as below structure: AddressBook.buff - Create this file and map in Class.
0a3e 0a0c 4162 6475 6c4a 6569 6c61 6e69
1001 1a1c 6162 6475 6c2e 7072 6f66 6573
7369 6f6e 616c 4067 6d61 696c 2e63 6f6d
220e 0a0a 3031 3233 3435 3637 3839 1000