Bencode (pronounced "Bee-Encode") is the encoding used by the peer-to-peer file sharing system BitTorrent for storing and transmitting loosely structured data.
It supports four different types of values:
Bencoding is most commonly used in .torrent files. These metadata files are simply bencoded dictionaries.
- byte strings,
- lists, and
- dictionaries (associative arrays).
While less efficient than a pure binary encoding, bencoding is simple and (because numbers are encoded in decimal notation) is unaffected by endianness, which is important for a cross platform application like BitTorrent. It is also fairly flexible, as long as applications ignore unexpected dictionary keys, so that new ones can be added without creating incompatibilities. -- Wikipedia.org
I have just released a very simple implementation of a Bencoding Input- and OutputStream in Java. It's a very lightweight implementation with only two classes and it doesn't depend on any external libraries.
I use it in early stages of (Network) application development to test my prototypes because it's much easier to use than for example Google's Protobuf.