@Override public String toString() { return content.toString(); }
@Override public String toString() { return content.toString(); }
@Override public String toString() { return content.toString(); }
result = buf.toString();
result = buf.toString();
xml = writer.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()); } }
xml = writer.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()); } }
xml = writer.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()); } }
/** * 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(); }
/** * 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()); }
/** * 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()); }
IOUtils.copy(reader, sw); reader.close(); SourceFile input = SourceFile.fromCode("input.js", sw.toString()); List<SourceFile> inputs = new ArrayList<>(1); inputs.add(input);
/** * 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(); }
/** * 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()); }
/** * 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(); }