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.jmod - Scripting Nashorn Module
JDK 11 jdk.scripting.nashorn.jmod is the JMOD file for JDK 11 Scripting Nashorn module.
JDK 11 Scripting Nashorn module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.scripting.nashorn.jmod.
JDK 11 Scripting Nashorn module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Scripting Nashorn module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.scripting.nashorn.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nashorn/api/scripting/Formatter.java
/* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.nashorn.api.scripting; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Formatter is a class to get the type conversion between javascript types and * java types for the format (sprintf) method working. * * <p>In javascript the type for numbers can be different from the format type * specifier. For format type '%d', '%o', '%x', '%X' double need to be * converted to integer. For format type 'e', 'E', 'f', 'g', 'G', 'a', 'A' * integer needs to be converted to double. * * <p>Format type "%c" and javascript string needs special handling. * * <p>The javascript date objects can be handled if they are type double (the * related javascript code will convert with Date.getTime() to double). So * double date types are converted to long. * * <p>Pattern and the logic for parameter position: java.util.Formatter * */ final class Formatter { private Formatter() { } /** * Method which converts javascript types to java types for the * String.format method (jrunscript function sprintf). * * @param format a format string * @param args arguments referenced by the format specifiers in format * @return a formatted string */ static String format(final String format, final Object[] args) { final Matcher m = FS_PATTERN.matcher(format); int positionalParameter = 1; while (m.find()) { int index = index(m.group(1)); final boolean previous = isPreviousArgument(m.group(2)); final char conversion = m.group(6).charAt(0); // skip over some formats if (index < 0 || previous || conversion == 'n' || conversion == '%') { continue; } // index 0 here means take a positional parameter if (index == 0) { index = positionalParameter++; } // out of index, String.format will handle if (index > args.length) { continue; } // current argument final Object arg = args[index - 1]; // for date we convert double to long if (m.group(5) != null) { // convert double to long if (arg instanceof Double) { args[index - 1] = ((Double) arg).longValue(); } } else { // we have to convert some types switch (conversion) { case 'd': case 'o': case 'x': case 'X': if (arg instanceof Double) { // convert double to long args[index - 1] = ((Double) arg).longValue(); } else if (arg instanceof String && ((String) arg).length() > 0) { // convert string (first character) to int args[index - 1] = (int) ((String) arg).charAt(0); } break; case 'e': case 'E': case 'f': case 'g': case 'G': case 'a': case 'A': if (arg instanceof Integer) { // convert integer to double args[index - 1] = ((Integer) arg).doubleValue(); } break; case 'c': if (arg instanceof Double) { // convert double to integer args[index - 1] = ((Double) arg).intValue(); } else if (arg instanceof String && ((String) arg).length() > 0) { // get the first character from string args[index - 1] = (int) ((String) arg).charAt(0); } break; default: break; } } } return String.format(format, args); } /** * Method to parse the integer of the argument index. * * @param s string to parse * @return -1 if parsing failed, 0 if string is null, > 0 integer */ private static int index(final String s) { int index = -1; if (s != null) { try { index = Integer.parseInt(s.substring(0, s.length() - 1)); } catch (final NumberFormatException e) { //ignored } } else { index = 0; } return index; } /** * Method to check if a string contains '<'. This is used to find out if * previous parameter is used. * * @param s string to check * @return true if '<' is in the string, else false */ private static boolean isPreviousArgument(final String s) { return (s != null && s.indexOf('<') >= 0); } // %[argument_index$][flags][width][.precision][t]conversion private static final String formatSpecifier = "%(\\d+\\$)?([-#+ 0,(\\<]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])"; // compiled format string private static final Pattern FS_PATTERN; static { FS_PATTERN = Pattern.compile(formatSpecifier); } }
⏎ jdk/nashorn/api/scripting/Formatter.java
Or download all of them as a single archive file:
File name: jdk.scripting.nashorn-11.0.1-src.zip File size: 1390965 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.scripting.nashorn.shell.jmod - Scripting Nashorn Shell Module
2020-04-25, 107257👍, 0💬
Popular Posts:
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...
Commons VFS provides a single API for accessing various different file systems. It presents a unifor...
Commons VFS provides a single API for accessing various different file systems. It presents a unifor...
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...