Serializes the given object to a JSON byte array @param object The object to serialize @return A JSON formatted byte array @throws IllegalArgumentException if the object was null @throws JSONException if the object could not be serialized
(final Object object)
| 288 | * @throws JSONException if the object could not be serialized |
| 289 | */ |
| 290 | public static final byte[] serializeToBytes(final Object object) { |
| 291 | if (object == null) |
| 292 | throw new IllegalArgumentException("Object was null"); |
| 293 | try { |
| 294 | return jsonMapper.writeValueAsBytes(object); |
| 295 | } catch (JsonProcessingException e) { |
| 296 | throw new JSONException(e); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Serializes the given object and wraps it in a callback function |
no outgoing calls