title: How to open svg file from binary mode
body: <p>I use RabbitMQ to queue and upload svg files. The producer downloads file from Google Drive and uploads to RabbitMQ in binary form. Then in Processing, which uses java I want to use the http API to open this file from queue. After the request API receives such content type</p>
  <pre><code>Reponse Content: [{&quot;payload_bytes&quot;:2175,&quot;redelivered&quot;:true,&quot;exchange&quot;:&quot;&quot;,&quot;routing_key&quot;:&quot;GoogleDrive&quot;,&quot;message_count&quot;:0,&quot;properties&quot;:[],&quot;payload&quot;:&quot;b'&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;iso-8859-1\&quot;?&gt;\\r\\n&lt;!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  --&gt;\\r\\n&lt;svg version=\&quot;1.1\&quot; id=\&quot;Layer_1\&quot; xmlns=\&quot;http://www.w3.org/2000/svg\&quot; xmlns:xlink=\&quot;http://www.w3.org/1999/xlink\&quot; x=\&quot;0px\&quot; y=\&quot;0px\&quot;\\r\\n\\t viewBox=\&quot;0 0 480 480\&quot; style=\&quot;enable-background:new 0 0 480 480;\&quot; xml:space=\&quot;preserve\&quot;&gt;\\r\\n&lt;g id=\&quot;XMLID_28_\&quot;&gt;\\r\\n\\t&lt;g&gt;\\r\\n\\t\\t&lt;path d=\&quot;M346.154,52.5c-1.013,0-2.025,0.012-3.032,0.034c-57.867,1.293-106.209,46.105-112.447,104.238\\r\\n\\t\\t\\tc-1.117,10.407,3.111,20.459,11.31,26.89l36.291,28.471c5.201,4.08,3.825,9.552,3.279,11.132c-0.546,1.58-2.841,6.735-9.452,6.735\\r\\n\\t\\t\\th-58.874c-12.621,0-23.644,7.635-28.083,19.449c-4.439,11.814-1.17,24.818,8.328,33.129l19.451,17.02\\r\\n\\t\\t\\tC223.776,309.092,230,322.807,230,337.226V380c0,5.523,4.477,10,10,10c5.522,0,10-4.477,10-10v-42.774\\r\\n\\t\\t\\tc0-20.187-8.713-39.388-23.905-52.68l-19.451-17.02c-4.836-4.231-3.347-9.522-2.776-11.043c0.571-1.521,2.935-6.483,9.361-6.483\\r\\n\\t\\t\\th58.874c12.985,0,24.116-7.931,28.356-20.205c4.239-12.273,0.377-25.383-9.839-33.398l-36.292-28.471\\r\\n\\t\\t\\tc-2.736-2.146-4.144-5.518-3.768-9.02c5.169-48.174,45.155-85.308,93.009-86.377c0.859-0.02,1.721-0.029,2.585-0.029\\r\\n\\t\\t\\tC408.929,72.5,460,123.752,460,186.75c0,30.872-13.555,59.91-37.19,79.669L264.87,398.465c-6.969,5.826-15.802,9.035-24.87,9.035\\r\\n\\t\\t\\tc-9.069,0-17.901-3.209-24.87-9.035L57.189,266.419C33.555,246.66,20,217.622,20,186.75C20,123.752,71.071,72.5,133.846,72.5\\r\\n\\t\\t\\tc26.294,0,50.986,8.739,71.408,25.272c4.292,3.474,10.589,2.812,14.064-1.48c3.476-4.292,2.813-10.589-1.479-14.064\\r\\n\\t\\t\\tC194.16,63.057,164.331,52.5,133.846,52.5C60.043,52.5,0,112.724,0,186.75c0,36.812,16.169,71.443,44.361,95.013l157.941,132.046\\r\\n\\t\\t\\tC212.862,422.638,226.25,427.5,240,427.5s27.138-4.862,37.699-13.691l157.94-132.046C463.831,258.193,480,223.562,480,186.75\\r\\n\\t\\t\\tC480,112.724,419.957,52.5,346.154,52.5z\&quot;/&gt;\\r\\n\\t&lt;/g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;g&gt;\\r\\n&lt;/g&gt;\\r\\n&lt;/svg&gt;\\r\\n'&quot;,&quot;payload_encoding&quot;:&quot;string&quot;}].
  </code></pre>
  <p>My question is how to take out this binary code from json and then open it as a regular SVG file?</p>
  <p>This is my code with request to RabbitMQ:</p>
  <pre><code>import http.requests.*;
  JSONObject json;
  
  
  public void setup() {
    size(400, 400);
    PostRequest post = new PostRequest(&quot;http://localhost:15672/api/queues/%2F/GoogleDrive/get&quot;);
    post.addHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);
    post.addUser(&quot;guest&quot;, &quot;guest&quot;);
    post.addData(&quot;{\&quot;count\&quot;:\&quot;1\&quot;,\&quot;requeue\&quot;:\&quot;false\&quot;,\&quot;encoding\&quot;:\&quot;auto\&quot;, \&quot;truncate\&quot;:\&quot;50000\&quot;, \&quot;ackmode\&quot;:\&quot;ack_requeue_true\&quot;}&quot;);
    post.send();
  
  
    System.out.println(&quot;Reponse Content: &quot; + post.getContent());
    System.out.println(&quot;Reponse Content-Length Header: &quot; + post.getHeader(&quot;Content-Length&quot;));
  }
  </code></pre>