Code example for ByteArrayOutputStream

Methods: toString

0
	} 
	public String formatEObject(String input) throws Exception {
		XtextResourceSet resourceSet = get(XtextResourceSet.class);
		XtextResource resource = (XtextResource) resourceSet.createResource(URI.createURI("dummy:/Test1.as"));
		resource.reparse(input);
		ByteArrayOutputStream formatted = new ByteArrayOutputStream();
		Builder options = SaveOptions.newBuilder();
		options.format();
		options.noValidation();
		resource.doSave(formatted, options.getOptions().toOptionsMap());
		return formatted.toString();
	} 
 
	public String formatNodeModel(String input, boolean preserve) throws Exception {
		IParser parser = getParser();
		IParseResult parseResult = parser.parse(new StringReader(input));
		IFormatter formatter = getInjector().getInstance(IFormatter.class);
		TokenStringBuffer buf = new TokenStringBuffer();
		ITokenStream fmt = formatter.createFormatterStream("", buf, preserve);
		INodeModelStreamer nodeModelStreamer = getInjector().getInstance(INodeModelStreamer.class);