/** * Returns a writer set in an attribute map. * * @return a writer in a attribute map */ public Writer getWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { return (Writer) getAttributeMap().get(AttributeName.WRITER); } return null; }
/** * Returns an error writer set in an attribute map. * * @return an error writer in a attribute map */ public Writer getErrorWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { return (Writer) getAttributeMap().get(AttributeName.ERROR_WRITER); } return null; }
/** * Returns an error writer set in an attribute map. * * @return an error writer in a attribute map */ public Writer getErrorWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { return (Writer) getAttributeMap().get(AttributeName.ERROR_WRITER); } return null; }
/** * Returns a reader set in an attribute map. * * @return a reader in an attribute map */ public Reader getReader() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.READER)) { return (Reader) getAttributeMap().get(AttributeName.READER); } return null; }
/** * Returns a reader set in an attribute map. * * @return a reader in an attribute map */ public Reader getReader() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.READER)) { return (Reader) getAttributeMap().get(AttributeName.READER); } return null; }
/** * Returns a writer set in an attribute map. * * @return a writer in a attribute map */ public Writer getWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { return (Writer) getAttributeMap().get(AttributeName.WRITER); } return null; }
/** * Returns an error writer set in an attribute map. * * @return an error writer in a attribute map */ public Writer getErrorWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { return (Writer) map.get(AttributeName.ERROR_WRITER); } return null; }
/** * Returns a reader set in an attribute map. * * @return a reader in an attribute map */ public Reader getReader() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.READER)) { return (Reader) map.get(AttributeName.READER); } return null; }
/** * Returns an error writer set in an attribute map. * * @return an error writer in a attribute map */ public Writer getErrorWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { return (Writer) map.get(AttributeName.ERROR_WRITER); } return null; }
/** * Returns a writer set in an attribute map. * * @return a writer in a attribute map */ public Writer getWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { return (Writer) map.get(AttributeName.WRITER); } return null; }
/** * Returns a reader set in an attribute map. * * @return a reader in an attribute map */ public Reader getReader() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.READER)) { return (Reader) map.get(AttributeName.READER); } return null; }
/** * Returns a writer set in an attribute map. * * @return a writer in a attribute map */ public Writer getWriter() { Map map = getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { return (Writer) map.get(AttributeName.WRITER); } return null; }
/** * Replaces a standard output by a specified writer. * * @param writer is a writer to be set */ public void setWriter(Writer writer) { if (writer == null) { return; } Map map = getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { Writer old = (Writer) map.get(AttributeName.WRITER); if (old == writer) { return; } } map.put(AttributeName.WRITER, writer); PrintStream pstream = new PrintStream(new WriterOutputStream(writer)); setOutputStream(pstream); }
private static void setStdErr(ScriptingContainer container, Writer writer) { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { Writer old = (Writer) map.get(AttributeName.ERROR_WRITER); if (old == writer) { return; } } map.put(AttributeName.ERROR_WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", io), GlobalVariable.Scope.GLOBAL); runtime.getObject().storeConstant("STDERR", io); runtime.getGlobalVariables().alias("$deferr", "$stderr"); }
private static void setErrorWriter(ScriptingContainer container, Writer writer) throws IOException, BadDescriptorException { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { Writer old = (Writer) map.get(AttributeName.ERROR_WRITER); if (old == writer) { return; } } map.put(AttributeName.ERROR_WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", io), GlobalVariable.Scope. GLOBAL); runtime.getObject().storeConstant("STDERR", io); runtime.getGlobalVariables().alias("$deferr", "$stderr"); }
private static void setStdErr(ScriptingContainer container, Writer writer) { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { Writer old = (Writer) map.get(AttributeName.ERROR_WRITER); if (old == writer) { return; } } map.put(AttributeName.ERROR_WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", io), GlobalVariable.Scope.GLOBAL); runtime.getObject().storeConstant("STDERR", io); runtime.getGlobalVariables().alias("$deferr", "$stderr"); }
private static void setErrorWriter(ScriptingContainer container, Writer writer) throws IOException, BadDescriptorException { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.ERROR_WRITER)) { Writer old = (Writer) map.get(AttributeName.ERROR_WRITER); if (old == writer) { return; } } map.put(AttributeName.ERROR_WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stderr", io), GlobalVariable.Scope. GLOBAL); runtime.getObject().storeConstant("STDERR", io); runtime.getGlobalVariables().alias("$deferr", "$stderr"); }
private static void setStdOut(ScriptingContainer container, Writer writer) { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { Writer old = (Writer) map.get(AttributeName.WRITER); if (old == writer) { return; } } map.put(AttributeName.WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", io), GlobalVariable.Scope.GLOBAL); runtime.getObject().storeConstant("STDOUT", io); runtime.getGlobalVariables().alias("$>", "$stdout"); runtime.getGlobalVariables().alias("$defout", "$stdout"); }
private static void setWriter(ScriptingContainer container, Writer writer) throws IOException, BadDescriptorException { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { Writer old = (Writer) map.get(AttributeName.WRITER); if (old == writer) { return; } } map.put(AttributeName.WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", io), GlobalVariable.Scope.GLOBAL); runtime.getObject().storeConstant("STDOUT", io); runtime.getGlobalVariables().alias("$>", "$stdout"); runtime.getGlobalVariables().alias("$defout", "$stdout"); }
private static void setWriter(ScriptingContainer container, Writer writer) throws IOException, BadDescriptorException { if (writer == null) { return; } Map map = container.getAttributeMap(); if (map.containsKey(AttributeName.WRITER)) { Writer old = (Writer) map.get(AttributeName.WRITER); if (old == writer) { return; } } map.put(AttributeName.WRITER, writer); Ruby runtime = container.getProvider().getRuntime(); RubyIO io = getRubyIO(runtime, writer); runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", io), GlobalVariable.Scope.GLOBAL); runtime.getObject().storeConstant("STDOUT", io); runtime.getGlobalVariables().alias("$>", "$stdout"); runtime.getGlobalVariables().alias("$defout", "$stdout"); }