Class IoUtil

java.lang.Object
org.jolokia.server.core.util.IoUtil

public class IoUtil extends Object
Since:
23.01.18
Author:
roland
  • Method Details

    • streamResponseAndClose

      public static void streamResponseAndClose(Writer pWriter, org.json.simple.JSONStreamAware pJson, String callback) throws IOException
      Stream a JSON stream to a given writer, potentiall wrap it in a callback for a JSONP response and then flush & close the writer. The writer is closed in any case, also when an exception occurs
      Parameters:
      pWriter - writer to write to. Must be not null.
      pJson - JSON response to stream
      callback - the name of the callback function if JSONP should be used or null if the answer should be streamed directly
      Throws:
      IOException - if the streaming fails