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.internal.le.jmod - Internal Line Editing Module
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module.
JDK 11 Internal Line Editing module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.internal.le.jmod.
JDK 11 Internal Line Editing module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Internal Line Editing module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.internal.le.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/internal/jline/extra/AnsiInterpretingOutputStream.java
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.internal.jline.extra; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import jdk.internal.jline.internal.Ansi; /**A stream that interprets some escape code sequences, and ignores those it does not support. */ public class AnsiInterpretingOutputStream extends OutputStream { private final String encoding; private final OutputStream out; private final Performer performer; private final Map<Character, AnsiCodeHandler> ESCAPE_CODE_ACTIONS = new HashMap<>(); private boolean inEscapeSequence; private ByteArrayOutputStream escape = new ByteArrayOutputStream(); public AnsiInterpretingOutputStream(String encoding, OutputStream output, Performer performer) { this.encoding = encoding; this.out = output; this.performer = performer; ESCAPE_CODE_ACTIONS.put('A', code -> { moveCursor(code, 0, -1); }); ESCAPE_CODE_ACTIONS.put('B', code -> { moveCursor(code, 0, +1); }); ESCAPE_CODE_ACTIONS.put('C', code -> { moveCursor(code, +1, 0); }); ESCAPE_CODE_ACTIONS.put('D', code -> { moveCursor(code, -1, 0); }); ESCAPE_CODE_ACTIONS.put('K', code -> { BufferState buffer = performer.getBufferState(); switch (parseOutIntValue(code, 0)) { case 0: for (int i = buffer.cursorX; i < buffer.sizeX - 1; i++) { out.write(' '); } performer.setCursorPosition(buffer.cursorX, buffer.cursorY); break; case 1: performer.setCursorPosition(0, buffer.cursorY); for (int i = 0; i < buffer.cursorX; i++) { out.write(' '); } break; case 2: for (int i = 0; i < buffer.sizeX - 1; i++) { out.write(' '); } performer.setCursorPosition(buffer.cursorX, buffer.cursorY); break; } out.flush(); }); } @Override public void write(int d) throws IOException { if (inEscapeSequence) { escape.write(d); String escapeCandidate = new String(escape.toByteArray(), encoding); if (Ansi.ANSI_CODE_PATTERN.asPredicate().test(escapeCandidate)) { //escape sequence: char key = escapeCandidate.charAt(escapeCandidate.length() - 1); AnsiCodeHandler handler = ESCAPE_CODE_ACTIONS.get(key); if (handler != null) { handler.handle(escapeCandidate); } else { //unknown escape sequence, ignore } inEscapeSequence = false; escape = null; } } else if (d == '\033') { inEscapeSequence = true; escape = new ByteArrayOutputStream(); escape.write(d); } else { out.write(d); } } @Override public void flush() throws IOException { out.flush(); } private void moveCursor(String code, int dx, int dy) throws IOException { int delta = parseOutIntValue(code, 1); BufferState buffer = performer.getBufferState(); int tx = buffer.cursorX + dx * delta; int ty = buffer.cursorY + dy * delta; tx = Math.max(0, Math.min(buffer.sizeX - 1, tx)); ty = Math.max(0, Math.min(buffer.sizeY - 1, ty)); performer.setCursorPosition(tx, ty); } private int parseOutIntValue(String code, int def) { try { return Integer.parseInt(code.substring(code.indexOf('[') + 1, code.length() - 1)); } catch (NumberFormatException ex) { return def; } } interface AnsiCodeHandler { public void handle(String code) throws IOException; } public interface Performer { public BufferState getBufferState() throws IOException; public void setCursorPosition(int cursorX, int cursorY) throws IOException; } public static class BufferState { public final int cursorX; public final int cursorY; public final int sizeX; public final int sizeY; public BufferState(int cursorX, int cursorY, int sizeX, int sizeY) { this.cursorX = cursorX; this.cursorY = cursorY; this.sizeX = sizeX; this.sizeY = sizeY; } } }
⏎ jdk/internal/jline/extra/AnsiInterpretingOutputStream.java
Or download all of them as a single archive file:
File name: jdk.internal.le-11.0.1-src.zip File size: 116985 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.internal.opt.jmod - Internal Opt Module
⇐ JDK 11 jdk.internal.jvmstat.jmod - Internal JVM Stat Module
2020-08-02, 18409👍, 0💬
Popular Posts:
JDK 11 jdk.dynalink.jmod is the JMOD file for JDK 11 Dynamic Linking module. JDK 11 Dynamic Linking ...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Jav...
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was develo...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...