Example: manipulating data
Convert a byte array to a string, and back
This example is for a MongoDB listener, but can easily be adapted to other environments. In this case, the packet object is a JSON object with an attribute called payload which contains a byte array.
In some cases, this may fail because the String constructor is ambiguous. In that case, you can use the BSONUtil class: