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.jfr.jmod - JFR Module
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module.
JDK 11 JFR module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.jfr.jmod.
JDK 11 JFR module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 JFR module source code files are stored in \fyicenter\jdk-11.0.1\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/MetadataWriter.java
/* * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jfr.internal; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_CONSTANT_POOL; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_DEFAULT_VALUE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_DIMENSION; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_GMT_OFFSET; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_ID; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_LOCALE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_NAME; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_SIMPLE_TYPE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_SUPER_TYPE; import static jdk.jfr.internal.MetadataDescriptor.ATTRIBUTE_TYPE_ID; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_ANNOTATION; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_FIELD; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_SETTING; import static jdk.jfr.internal.MetadataDescriptor.ELEMENT_TYPE; import java.io.DataOutput; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Set; import jdk.jfr.AnnotationElement; import jdk.jfr.SettingDescriptor; import jdk.jfr.ValueDescriptor; import jdk.jfr.internal.MetadataDescriptor.Attribute; import jdk.jfr.internal.MetadataDescriptor.Element; import jdk.jfr.internal.consumer.RecordingInput; /** * Class responsible for converting a list of types into a format that can be * parsed by a client. * */ final class MetadataWriter { private final Element metadata = new Element("metadata"); private final Element root = new Element("root"); public MetadataWriter(MetadataDescriptor descriptor) { descriptor.getTypes().forEach(type -> makeTypeElement(metadata, type)); root.add(metadata); Element region = new Element("region"); region.addAttribute(ATTRIBUTE_LOCALE, descriptor.locale); region.addAttribute(ATTRIBUTE_GMT_OFFSET, descriptor.gmtOffset); root.add(region); } public void writeBinary(DataOutput output) throws IOException { Set<String> stringPool = new HashSet<>(1000); // Possible improvement, sort string by how often they occur. // and assign low number to the most frequently used. buildStringPool(root, stringPool); HashMap<String, Integer> lookup = new LinkedHashMap<>(stringPool.size()); int index = 0; int poolSize = stringPool.size(); writeInt(output, poolSize); for (String s : stringPool) { lookup.put(s, index); writeString(output, s); index++; } write(output, root, lookup); } private void writeString(DataOutput out, String s) throws IOException { if (s == null ) { out.writeByte(RecordingInput.STRING_ENCODING_NULL); return; } out.writeByte(RecordingInput.STRING_ENCODING_CHAR_ARRAY); // encoding UTF-16 int length = s.length(); writeInt(out, length); for (int i = 0; i < length; i++) { writeInt(out, s.charAt(i)); } } private void writeInt(DataOutput out, int v) throws IOException { long s = v & 0xffffffffL; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // first byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // second byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } out.write((byte) (s | 0x80)); // third byte written s >>= 7; if (s < 1 << 7) { out.write((byte) (s)); return; } s >>= 7; out.write((byte) (s));// fourth byte written } private void buildStringPool(Element element, Set<String> pool) { pool.add(element.name); for (Attribute a : element.attributes) { pool.add(a.name); pool.add(a.value); } for (Element child : element.elements) { buildStringPool(child, pool); } } private void write(DataOutput output,Element element, HashMap<String, Integer> lookup) throws IOException { writeInt(output, lookup.get(element.name)); writeInt(output, element.attributes.size()); for (Attribute a : element.attributes) { writeInt(output, lookup.get(a.name)); writeInt(output, lookup.get(a.value)); } writeInt(output, element.elements.size()); for (Element child : element.elements) { write(output, child, lookup); } } private void makeTypeElement(Element root, Type type) { Element element = root.newChild(ELEMENT_TYPE); element.addAttribute(ATTRIBUTE_NAME, type.getName()); String superType = type.getSuperType(); if (superType != null) { element.addAttribute(ATTRIBUTE_SUPER_TYPE, superType); } if (type.isSimpleType()) { element.addAttribute(ATTRIBUTE_SIMPLE_TYPE, true); } element.addAttribute(ATTRIBUTE_ID, type.getId()); if (type instanceof PlatformEventType) { for (SettingDescriptor v : ((PlatformEventType)type).getSettings()) { makeSettingElement(element, v); } } for (ValueDescriptor v : type.getFields()) { makeFieldElement(element, v); } for (AnnotationElement a : type.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeSettingElement(Element typeElement, SettingDescriptor s) { Element element = typeElement.newChild(ELEMENT_SETTING); element.addAttribute(ATTRIBUTE_NAME, s.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, s.getTypeId()); element.addAttribute(ATTRIBUTE_DEFAULT_VALUE, s.getDefaultValue()); for (AnnotationElement a : s.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeFieldElement(Element typeElement, ValueDescriptor v) { Element element = typeElement.newChild(ELEMENT_FIELD); element.addAttribute(ATTRIBUTE_NAME, v.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, v.getTypeId()); if (v.isArray()) { element.addAttribute(ATTRIBUTE_DIMENSION, 1); } if (PrivateAccess.getInstance().isConstantPool(v)) { element.addAttribute(ATTRIBUTE_CONSTANT_POOL, true); } for (AnnotationElement a : v.getAnnotationElements()) { makeAnnotation(element, a); } } private void makeAnnotation(Element entity, AnnotationElement annotation) { Element element = entity.newChild(ELEMENT_ANNOTATION); element.addAttribute(ATTRIBUTE_TYPE_ID, annotation.getTypeId()); List<Object> values = annotation.getValues(); int index = 0; for (ValueDescriptor v : annotation.getValueDescriptors()) { Object value = values.get(index++); if (v.isArray()) { element.addArrayAttribute(element, v.getName(), value); } else { element.addAttribute(v.getName(), value); } } } }
⏎ jdk/jfr/internal/MetadataWriter.java
Or download all of them as a single archive file:
File name: jdk.jfr-11.0.1-src.zip File size: 237632 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.jlink.jmod - JLink Tool
2020-06-30, 43657👍, 0💬
Popular Posts:
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
What Is fop.jar? I got it from the fop-2.7-bin.zip. fop.jar in fop-2.7-bin.zip is the JAR file for F...
This package is the backport of java.util.concurrent API, introduced in Java 5.0 and further refined...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...