예제 #1
0
 /**
  * Writes a JSONObject out to the following output stream.
  *
  * @param object the object to write.
  * @param writer the writer to write to.
  * @throws IOException if a write error occurs.
  * @since 2.5.1
  */
 public static void writeJSON(Object object, Writer writer) throws IOException {
   writeJSON(JSONObject.create(object), writer);
 }
예제 #2
0
 /**
  * Writes a JSONObject out to the following output stream.
  *
  * @param object the object to write.
  * @return the JSONObject as a JSON string.
  * @throws IOException if a write error occurs.
  * @since 2.5.1
  */
 public static String writeJSONString(Object object) throws IOException {
   StringWriter sw = new StringWriter();
   writeJSON(JSONObject.create(object), sw);
   return sw.toString();
 }
예제 #3
0
 /**
  * Writes a JSONObject out to the following output stream.
  *
  * @param object the object to write.
  * @param out the output stream to write to.
  * @throws IOException if a write error occurs.
  * @since 2.5.1
  */
 public static void writeJSON(Object object, OutputStream out) throws IOException {
   writeJSON(JSONObject.create(object), out);
 }