src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataWriter.java
changeset 58863 c16ac7a2eba4
parent 50113 caf115bb98ad
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    51 import jdk.jfr.AnnotationElement;
    51 import jdk.jfr.AnnotationElement;
    52 import jdk.jfr.SettingDescriptor;
    52 import jdk.jfr.SettingDescriptor;
    53 import jdk.jfr.ValueDescriptor;
    53 import jdk.jfr.ValueDescriptor;
    54 import jdk.jfr.internal.MetadataDescriptor.Attribute;
    54 import jdk.jfr.internal.MetadataDescriptor.Attribute;
    55 import jdk.jfr.internal.MetadataDescriptor.Element;
    55 import jdk.jfr.internal.MetadataDescriptor.Element;
    56 import jdk.jfr.internal.consumer.RecordingInput;
    56 import jdk.jfr.internal.consumer.StringParser;
    57 
    57 
    58 /**
    58 /**
    59  * Class responsible for converting a list of types into a format that can be
    59  * Class responsible for converting a list of types into a format that can be
    60  * parsed by a client.
    60  * parsed by a client.
    61  *
    61  *
    92         write(output, root, lookup);
    92         write(output, root, lookup);
    93     }
    93     }
    94 
    94 
    95     private void writeString(DataOutput out, String s) throws IOException {
    95     private void writeString(DataOutput out, String s) throws IOException {
    96         if (s == null ) {
    96         if (s == null ) {
    97             out.writeByte(RecordingInput.STRING_ENCODING_NULL);
    97             out.writeByte(StringParser.Encoding.NULL.byteValue());
    98             return;
    98             return;
    99         }
    99         }
   100         out.writeByte(RecordingInput.STRING_ENCODING_CHAR_ARRAY); // encoding UTF-16
   100         out.writeByte(StringParser.Encoding.CHAR_ARRAY.byteValue()); // encoding UTF-16
   101         int length = s.length();
   101         int length = s.length();
   102         writeInt(out, length);
   102         writeInt(out, length);
   103             for (int i = 0; i < length; i++) {
   103             for (int i = 0; i < length; i++) {
   104                 writeInt(out, s.charAt(i));
   104                 writeInt(out, s.charAt(i));
   105             }
   105             }