@Override public ByteBuffer toMedia(Object object){
  String value=(object instanceof String || object instanceof JsonArray || object instanceof JsonObject) ? object.toString() : gson.toJson(object);
  return ByteBuffer.wrap(value.getBytes(Charset.defaultCharset()));
}

@ Override public ByteBuffer toMedia ( Object object ) { String value = ( object instanceof String || object instanceof JsonArray || object instanceof JsonObject ) ? object . toString ( ) : gson . toJson ( object ) ; return ByteBuffer . wrap ( value . getBytes ( Charset . defaultCharset ( ) ) ) ; }
convert an object to a json encoded byte buffer .
