1. Amirouche Boubekki
  2. msgpack-java-lite


Alternate msppack implementation for Java.

This implementation complements the standard msgpack library for Java:

Main differences:
	- (Much) Simpler API
	- No external dependencies
	- No builtin support for native object serialization, annotations, or RPC.
	- It's very minimalistic - at the time of this writing, the entire redistributable
	  library is only ~11kb ... with full library sources for reference.
import net.asdfa.msgpack;
List<Object> objects = Arrays.asList("potatoes", false, 11, null);
//pack it:
byte[] data = MsgPack.pack(objects);

//unpack it:
Object unpacked = MsgPack.unpack(data);
System.out.println("Unpacked data: " + unpacked);

See Test.java for more examples.
You can also pack/unpack to/from Data(Output/Input)Streams.
You can also specify unpacking options:
    Object unpacked = MsgPack.unpack(data, UNPACK_RAW_AS_STRING);
  to unpack things as something other than a raw byte[].

This implementation uses the builtin Java types:
 - null
 - Boolean
 - Number (byte, short, int, and long are considered interchangeable when packing/unpacking, other considerations)
 - String (UTF-8), byte[], or ByteBuffer (the *whole* buffer) (always unpacked as a ByteBuffer)
 - Map (any type may be used for packing, always unpacked as a HashMap)
 - List (any type may be used for packing, always unpacked as an ArrayList)
Passing any other type to MsgPack.pack() will throw an IllegalArumentException.

Note that the implementation does no recursion checks - If you pass a cyclic object
it will hang in an infinite loop.