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.jshell.jmod - JShell Tool
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell" command.
JDK 11 JShell tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jshell.jmod.
JDK 11 JShell tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 JShell tool source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.jshell.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/internal/jshell/tool/StopDetectingInputStream.java
/* * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.internal.jshell.tool; import java.io.IOException; import java.io.InputStream; import java.util.function.Consumer; public final class StopDetectingInputStream extends InputStream { public static final int INITIAL_SIZE = 128; private final Runnable stop; private final Consumer<Exception> errorHandler; private boolean initialized; private int[] buffer = new int[INITIAL_SIZE]; private int start; private int end; private State state = State.WAIT; public StopDetectingInputStream(Runnable stop, Consumer<Exception> errorHandler) { this.stop = stop; this.errorHandler = errorHandler; } public synchronized InputStream setInputStream(InputStream input) { if (initialized) throw new IllegalStateException("Already initialized."); initialized = true; Thread reader = new Thread(() -> { try { int read; while (true) { //to support external terminal editors, the "cmdin.read" must not run when //an external editor is running. At the same time, it needs to run while the //user's code is running (so Ctrl-C is detected). Hence waiting here until //there is a confirmed need for input. State currentState = waitInputNeeded(); if (currentState == State.CLOSED) { break; } if ((read = input.read()) == (-1)) { break; } if (read == 3 && getState() == State.BUFFER) { stop.run(); } else { write(read); } } } catch (IOException ex) { errorHandler.accept(ex); } finally { shutdown(); } }); reader.setDaemon(true); reader.start(); return this; } @Override public synchronized int read() { while (start == end) { if (state == State.CLOSED) { return -1; } if (state == State.WAIT) { state = State.READ; } notifyAll(); try { wait(); } catch (InterruptedException ex) { //ignore } } try { return buffer[start]; } finally { start = (start + 1) % buffer.length; } } public synchronized void shutdown() { state = State.CLOSED; notifyAll(); } public synchronized void write(int b) { if (state != State.BUFFER) { state = State.WAIT; } int newEnd = (end + 1) % buffer.length; if (newEnd == start) { //overflow: int[] newBuffer = new int[buffer.length * 2]; int rightPart = (end > start ? end : buffer.length) - start; int leftPart = end > start ? 0 : start - 1; System.arraycopy(buffer, start, newBuffer, 0, rightPart); System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart); buffer = newBuffer; start = 0; end = rightPart + leftPart; newEnd = end + 1; } buffer[end] = b; end = newEnd; notifyAll(); } public synchronized void setState(State state) { if (this.state != State.CLOSED) { this.state = state; notifyAll(); } } private synchronized State getState() { return state; } private synchronized State waitInputNeeded() { while (state == State.WAIT) { try { wait(); } catch (InterruptedException ex) { //ignore } } return state; } public enum State { /* No reading from the input should happen. This is the default state. The StopDetectingInput * must be in this state when an external editor is being run, so that the external editor * can read from the input. */ WAIT, /* A single input character should be read. Reading from the StopDetectingInput will move it * into this state, and the state will be automatically changed back to WAIT when a single * input character is obtained. This state is typically used while the user is editing the * input line. */ READ, /* Continuously read from the input. Forward Ctrl-C ((int) 3) to the "stop" Runnable, buffer * all other input. This state is typically used while the user's code is running, to provide * the ability to detect Ctrl-C in order to stop the execution. */ BUFFER, /* The input is closed. */ CLOSED } }
⏎ jdk/internal/jshell/tool/StopDetectingInputStream.java
Or download all of them as a single archive file:
File name: jdk.jshell-11.0.1-src.zip File size: 283093 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.jsobject.jmod - JS Object Module
2020-06-30, 29311👍, 0💬
Popular Posts:
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
commons-lang-1.0.1.jar is the JAR file for Apache Commons Lang 1.0.1, which provides a host of helpe...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.5.0-src.zip...
How to read XML document from socket connections with the socket\DelayedInput.java provided in the A...