Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 jdk.scripting.nashorn.shell.jmod - Scripting Nashorn Shell Module
JDK 11 jdk.scripting.nashorn.shell.jmod is the JMOD file for JDK 11 Scripting Nashorn Shell module.
JDK 11 Scripting Nashorn Shell module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.scripting.nashorn.shell.jmod.
JDK 11 Scripting Nashorn Shell module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Scripting Nashorn Shell module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.scripting.nashorn.shell.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nashorn/tools/jjs/HistoryObject.java
/* * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.nashorn.tools.jjs; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; import jdk.internal.jline.console.history.History; import jdk.nashorn.api.scripting.AbstractJSObject; import jdk.nashorn.api.scripting.JSObject; import jdk.nashorn.internal.runtime.JSType; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; /* * A script friendly object that exposes history of commands to scripts. */ final class HistoryObject extends AbstractJSObject { private static final Set<String> props; static { final HashSet<String> s = new HashSet<>(); s.add("clear"); s.add("forEach"); s.add("load"); s.add("print"); s.add("save"); s.add("size"); s.add("toString"); props = Collections.unmodifiableSet(s); } private final History hist; private final PrintWriter err; private final Consumer<String> evaluator; HistoryObject(final History hist, final PrintWriter err, final Consumer<String> evaluator) { this.hist = hist; this.err = err; this.evaluator = evaluator; } @Override public boolean isFunction() { return true; } @Override public Object call(final Object thiz, final Object... args) { if (args.length > 0) { int index = JSType.toInteger(args[0]); if (index < 0) { index += (hist.size() - 1); } else { index--; } if (index >= 0 && index < (hist.size() - 1)) { final CharSequence src = hist.get(index); hist.replace(src); err.println(src); evaluator.accept(src.toString()); } else { hist.removeLast(); err.println("no history entry @ " + (index + 1)); } } return UNDEFINED; } @Override public Object getMember(final String name) { switch (name) { case "clear": return (Runnable)hist::clear; case "forEach": return (Function<JSObject, Object>)this::iterate; case "load": return (Consumer<Object>)this::load; case "print": return (Runnable)this::print; case "save": return (Consumer<Object>)this::save; case "size": return hist.size(); case "toString": return (Supplier<String>)this::toString; } return UNDEFINED; } @Override public Object getDefaultValue(final Class<?> hint) { if (hint == String.class) { return toString(); } return UNDEFINED; } @Override public String toString() { final StringBuilder buf = new StringBuilder(); for (History.Entry e : hist) { buf.append(e.value()).append('\n'); } return buf.toString(); } @Override public Set<String> keySet() { return props; } private void save(final Object obj) { final File file = getFile(obj); try (final PrintWriter pw = new PrintWriter(file)) { for (History.Entry e : hist) { pw.println(e.value()); } } catch (final IOException exp) { throw new RuntimeException(exp); } } private void load(final Object obj) { final File file = getFile(obj); String item = null; try (final BufferedReader r = new BufferedReader(new FileReader(file))) { while ((item = r.readLine()) != null) { hist.add(item); } } catch (final IOException exp) { throw new RuntimeException(exp); } } private void print() { for (History.Entry e : hist) { System.out.printf("%3d %s\n", e.index() + 1, e.value()); } } private Object iterate(final JSObject func) { for (History.Entry e : hist) { if (JSType.toBoolean(func.call(this, e.value().toString()))) { break; // return true from callback to skip iteration } } return UNDEFINED; } private static File getFile(final Object obj) { File file = null; if (obj instanceof String) { file = new File((String)obj); } else if (obj instanceof File) { file = (File)obj; } else { throw typeError("not.a.file", JSType.toString(obj)); } return file; } }
⏎ jdk/nashorn/tools/jjs/HistoryObject.java
Or download all of them as a single archive file:
File name: jdk.scripting.nashorn.shell-11.0.1-src.zip File size: 22002 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.sctp.jmod - SCTP Module
⇐ JDK 11 jdk.scripting.nashorn.jmod - Scripting Nashorn Module
2019-12-02, 5946👍, 0💬
Popular Posts:
JDK 17 java.management.jmod is the JMOD file for JDK 17 Management module. JDK 17 Management module ...
JDK 11 jdk.jdi.jmod is the JMOD file for JDK 11 JDI (Java Debug Interface) tool. JDK 11 JDI tool com...
JDK 6 tools.jar is the JAR file for JDK 6 tools. It contains Java classes to support different JDK t...
What Is poi-examples-5.2.3.jar? poi-examples-5.2.3.jar is one of the JAR files for Apache POI 5.2.3,...
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...