/** * Instantiates a new fake jsp writer. */ public FakeJspWriter() { super(0, false); rootWriter = new StringBuilderWriter(512); printWriter = new PrintWriter(rootWriter); }
@Override public String toString() { return content.toString(); }
public void write(char[] cbuf, int off, int len) throws IOException { content.write(cbuf, off, len); } }
/** * Converts a given JavaScript native object and converts it to the relevant JSON string. * * @param object JavaScript object * @return String JSON * @throws IOException */ @ScriptMethod ( help="Converts a given JavaScript native object and converts it to the relevant JSON string.", code="//JavaScript Sample Code\nvar myObj = {'name':'Test Object','size':100};\nvar myObjAsString = jsonUtils.toJSONString(myObj);", output="JSON string" ) public String toJSONString(@ScriptParameter(help="JavaScript object") Object object) throws IOException { StringBuilderWriter buffer = new StringBuilderWriter(128); valueToJSONString(object, new JSONWriter(buffer)); return buffer.toString(); }
public void createDocuments(List<Pair<String, Document>> pathContents) throws IOException { for (Pair<String, Document> pathContent : pathContents) { OutputFormat format = OutputFormat.createPrettyPrint(); format.setSuppressDeclaration(false); StringBuilderWriter writer = new StringBuilderWriter(1024); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(pathContent.getSecond()); xmlWriter.flush(); writer.close(); createDocument(pathContent.getFirst(), writer.toString()); } }
public void flush() { content.flush(); }
/** * Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object. * This is a specialized method only used by routines that will later expect a JSONObject. * * @param object JavaScript native object * @return JSONObject * @throws IOException */ @ScriptMethod ( help="Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object.", output="the created org.json.simple.JSONObject Java Object" ) public JSONObject toJSONObject(Object object) throws IOException { StringBuilderWriter buffer = new StringBuilderWriter(128); valueToJSONString(object, new JSONWriter(buffer)); return (JSONObject)JSONValue.parse(buffer.toString()); }
public void createDocuments(List<Pair<String, Document>> pathContents) throws IOException { for (Pair<String, Document> pathContent : pathContents) { OutputFormat format = OutputFormat.createPrettyPrint(); format.setSuppressDeclaration(false); StringBuilderWriter writer = new StringBuilderWriter(1024); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(pathContent.getSecond()); xmlWriter.flush(); writer.close(); createDocument(pathContent.getFirst(), writer.toString()); } }
public void flush() { content.flush(); }
/** * Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object. * This is a specialized method only used by routines that will later expect a JSONObject. * * @param object JavaScript native object * @return JSONObject * @throws IOException */ @ScriptMethod ( help="Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object.", output="the created org.json.simple.JSONObject Java Object" ) public JSONObject toJSONObject(Object object) throws IOException { StringBuilderWriter buffer = new StringBuilderWriter(128); valueToJSONString(object, new JSONWriter(buffer)); return (JSONObject)JSONValue.parse(buffer.toString()); }
public void createDocuments(List<Pair<String, Document>> pathContents) throws IOException { for (Pair<String, Document> pathContent : pathContents) { OutputFormat format = OutputFormat.createPrettyPrint(); format.setSuppressDeclaration(false); StringBuilderWriter writer = new StringBuilderWriter(1024); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(pathContent.getSecond()); xmlWriter.flush(); writer.close(); createDocument(pathContent.getFirst(), writer.toString()); } }
/** * Instantiates a new fake jsp writer. */ public FakeJspWriter() { super(0, false); rootWriter = new StringBuilderWriter(512); printWriter = new PrintWriter(rootWriter); }
public void write(char[] cbuf, int off, int len) throws IOException { content.write(cbuf, off, len); } }
@Override public String toString() { return content.toString(); }
public void flush() { content.flush(); }
/** * Converts a given JavaScript native object and converts it to the relevant JSON string. * * @param object JavaScript object * @return String JSON * @throws IOException */ @ScriptMethod ( help="Converts a given JavaScript native object and converts it to the relevant JSON string.", code="//JavaScript Sample Code\nvar myObj = {'name':'Test Object','size':100};\nvar myObjAsString = jsonUtils.toJSONString(myObj);", output="JSON string" ) public String toJSONString(@ScriptParameter(help="JavaScript object") Object object) throws IOException { StringBuilderWriter buffer = new StringBuilderWriter(128); valueToJSONString(object, new JSONWriter(buffer)); return buffer.toString(); }
/** * Instantiates a new fake jsp writer. * * @param arg0 * the arg0 * @param arg1 * the arg1 */ public FakeJspWriter(int arg0, boolean arg1) { super(arg0, arg1); rootWriter = new StringBuilderWriter(512); printWriter = new PrintWriter(rootWriter); }
public void write(char[] cbuf, int off, int len) throws IOException { content.write(cbuf, off, len); } }
@Override public String toString() { return content.toString(); }
/** * Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object. * This is a specialized method only used by routines that will later expect a JSONObject. * * @param object JavaScript native object * @return JSONObject * @throws IOException */ @ScriptMethod ( help="Converts the given JavaScript native object to a org.json.simple.JSONObject Java Object.", output="the created org.json.simple.JSONObject Java Object" ) public JSONObject toJSONObject(Object object) throws IOException { StringBuilderWriter buffer = new StringBuilderWriter(128); valueToJSONString(object, new JSONWriter(buffer)); return (JSONObject)JSONValue.parse(buffer.toString()); }