Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
Collections:
Other Resources:
JDK 17 jdk.jfr.jmod - JFR Module
JDK 17 jdk.jfr.jmod is the JMOD file for JDK 17 JFR module.
JDK 17 JFR module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jfr.jmod.
JDK 17 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JFR module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jfr.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jfr/internal/consumer/StringParser.java
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jfr.internal.consumer;
import java.io.IOException;
import java.nio.charset.Charset;
public final class StringParser extends Parser {
public enum Encoding {
NULL(0),
EMPTY_STRING(1),
CONSTANT_POOL(2),
UT8_BYTE_ARRAY(3),
CHAR_ARRAY(4),
LATIN1_BYTE_ARRAY(5);
private byte byteValue;
private Encoding(int byteValue) {
this.byteValue = (byte) byteValue;
}
public byte byteValue() {
return byteValue;
}
public boolean is(byte value) {
return value == byteValue;
}
}
private static final Charset UTF8 = Charset.forName("UTF-8");
private static final Charset LATIN1 = Charset.forName("ISO-8859-1");
private static final class CharsetParser extends Parser {
private final Charset charset;
private int lastSize;
private byte[] buffer = new byte[16];
private String lastString;
CharsetParser(Charset charset) {
this.charset = charset;
}
@Override
public Object parse(RecordingInput input) throws IOException {
int size = input.readInt();
input.require(size, "String size %d exceeds available data");
ensureSize(size);
if (lastSize == size) {
boolean equalsLastString = true;
for (int i = 0; i < size; i++) {
// TODO: No need to read byte per byte
byte b = input.readByte();
if (buffer[i] != b) {
equalsLastString = false;
buffer[i] = b;
}
}
if (equalsLastString) {
return lastString;
}
} else {
for (int i = 0; i < size; i++) {
buffer[i] = input.readByte();
}
}
lastString = new String(buffer, 0, size, charset);
lastSize = size;
return lastString;
}
@Override
public void skip(RecordingInput input) throws IOException {
int size = input.readInt();
input.skipBytes(size);
}
private void ensureSize(int size) {
if (buffer.length < size) {
buffer = new byte[size];
}
}
}
private static final class CharArrayParser extends Parser {
private char[] buffer = new char[16];
private int lastSize = -1;
private String lastString = null;
@Override
public Object parse(RecordingInput input) throws IOException {
int size = input.readInt();
input.require(size, "String size %d exceeds available data");
ensureSize(size);
if (lastSize == size) {
boolean equalsLastString = true;
for (int i = 0; i < size; i++) {
char c = input.readChar();
if (buffer[i] != c) {
equalsLastString = false;
buffer[i] = c;
}
}
if (equalsLastString) {
return lastString;
}
} else {
for (int i = 0; i < size; i++) {
buffer[i] = input.readChar();
}
}
lastString = new String(buffer, 0, size);
lastSize = size;
return lastString;
}
@Override
public void skip(RecordingInput input) throws IOException {
int size = input.readInt();
for (int i = 0; i < size; i++) {
input.readChar();
}
}
private void ensureSize(int size) {
if (buffer.length < size) {
buffer = new char[size];
}
}
}
private final ConstantLookup stringLookup;
private final CharArrayParser charArrayParser = new CharArrayParser();
private final CharsetParser utf8parser = new CharsetParser(UTF8);
private final CharsetParser latin1parser = new CharsetParser(LATIN1);
private final boolean event;
public StringParser(ConstantLookup stringLookup, boolean event) {
this.stringLookup = stringLookup;
this.event = event;
}
@Override
public Object parse(RecordingInput input) throws IOException {
byte encoding = input.readByte();
if (Encoding.CONSTANT_POOL.is(encoding)) {
long key = input.readLong();
if (event) {
return stringLookup.getCurrentResolved(key);
} else {
return stringLookup.getCurrent(key);
}
}
if (Encoding.NULL.is(encoding)) {
return null;
}
if (Encoding.EMPTY_STRING.is(encoding)) {
return "";
}
if (Encoding.CHAR_ARRAY.is(encoding)) {
return charArrayParser.parse(input);
}
if (Encoding.UT8_BYTE_ARRAY.is(encoding)) {
return utf8parser.parse(input);
}
if (Encoding.LATIN1_BYTE_ARRAY.is(encoding)) {
return latin1parser.parse(input);
}
throw new IOException("Unknown string encoding " + encoding);
}
@Override
public void skip(RecordingInput input) throws IOException {
byte encoding = input.readByte();
if (Encoding.CONSTANT_POOL.is(encoding)) {
input.readLong();
return;
}
if (Encoding.EMPTY_STRING.is(encoding)) {
return;
}
if (Encoding.NULL.is(encoding)) {
return;
}
if (Encoding.CHAR_ARRAY.is(encoding)) {
charArrayParser.skip(input);
return;
}
if (Encoding.UT8_BYTE_ARRAY.is(encoding)) {
utf8parser.skip(input);
return;
}
if (Encoding.LATIN1_BYTE_ARRAY.is(encoding)) {
latin1parser.skip(input);
return;
}
throw new IOException("Unknown string encoding " + encoding);
}
}
⏎ jdk/jfr/internal/consumer/StringParser.java
Or download all of them as a single archive file:
File name: jdk.jfr-17.0.5-src.zip File size: 363343 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jlink.jmod - JLink Tool
2023-04-17, ≈55🔥, 0💬
Popular Posts:
How to read XML document with XML Schema validation from socket connections with the socket\DelayedI...
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
JDK 11 jdk.scripting.nashorn.jm odis the JMOD file for JDK 11 Scripting Nashorn module. JDK 11 Scrip...
What Is poi-ooxml-3.5.jar? poi-ooxml-3.5.jar is one of the JAR files for Apache POI 3.5, which provi...