@Override public Writer getWriter() { if (stdoutBuffer==null) { synchronized(this) { if (stdoutBuffer==null) { Writer superWriter = super.getWriter(); stdoutBuffer = new DiagWriter(superWriter, " stdout "); } } } return stdoutBuffer; }
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); ScriptEngine engine = new EmbeddedRhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(ScriptEngine.FILENAME, args[0]); engine.eval(r, context); context.getWriter().flush(); } }
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); ScriptEngine engine = new EmbeddedRhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(ScriptEngine.FILENAME, args[0]); engine.eval(r, context); context.getWriter().flush(); } }
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); ScriptEngine engine = new RhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(ScriptEngine.FILENAME, args[0]); engine.eval(r, context); // added this statement to save some typing to most script authors context.getWriter().flush(); } }
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); ScriptEngine engine = new RhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(ScriptEngine.FILENAME, args[0]); engine.eval(r, context); // added this statement to save some typing to most script authors context.getWriter().flush(); } }
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("No file specified"); return; } InputStreamReader r = new InputStreamReader(new FileInputStream(args[0])); RhinoScriptEngine engine = new RhinoScriptEngine(); SimpleScriptContext context = new SimpleScriptContext(); engine.put(RhinoScriptEngine.FILENAME, args[0]); engine.eval(r, context); // added this statement to save some typing to most script authors context.getWriter().flush(); } }
@Override public synchronized void closeDirect() { if (this.scriptContext != null) { try { this.scriptContext.getErrorWriter().flush(); } catch (IOException e) { } try { this.scriptContext.getWriter().flush(); } catch (IOException e) { } } super.closeDirect(); reset(); }
@Override public synchronized void closeDirect() { if (this.scriptContext != null) { try { this.scriptContext.getErrorWriter().flush(); } catch (IOException e) { } try { this.scriptContext.getWriter().flush(); } catch (IOException e) { } } super.closeDirect(); reset(); }
@Override public synchronized void closeDirect() { if (this.scriptContext != null) { try { this.scriptContext.getErrorWriter().flush(); } catch (IOException e) { } try { this.scriptContext.getWriter().flush(); } catch (IOException e) { } } super.closeDirect(); reset(); }