src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.libgraal/src/jdk/internal/vm/compiler/libgraal/OptionsEncoder.java
equal
deleted
inserted
replaced
27 import java.io.ByteArrayInputStream; |
27 import java.io.ByteArrayInputStream; |
28 import java.io.ByteArrayOutputStream; |
28 import java.io.ByteArrayOutputStream; |
29 import java.io.DataInputStream; |
29 import java.io.DataInputStream; |
30 import java.io.DataOutputStream; |
30 import java.io.DataOutputStream; |
31 import java.io.IOException; |
31 import java.io.IOException; |
32 import java.util.HashMap; |
32 import java.util.LinkedHashMap; |
33 import java.util.Map; |
33 import java.util.Map; |
34 |
34 |
35 /** |
35 /** |
36 * Facilities for encoding/decoding a set of options to/from a byte array. |
36 * Facilities for encoding/decoding a set of options to/from a byte array. |
37 */ |
37 */ |
120 * Decodes {@code input} into a name/value map. |
120 * Decodes {@code input} into a name/value map. |
121 * |
121 * |
122 * @throws IllegalArgumentException if {@code input} cannot be decoded |
122 * @throws IllegalArgumentException if {@code input} cannot be decoded |
123 */ |
123 */ |
124 public static Map<String, Object> decode(byte[] input) { |
124 public static Map<String, Object> decode(byte[] input) { |
125 Map<String, Object> res = new HashMap<>(); |
125 Map<String, Object> res = new LinkedHashMap<>(); |
126 try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(input))) { |
126 try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(input))) { |
127 final int size = in.readInt(); |
127 final int size = in.readInt(); |
128 for (int i = 0; i < size; i++) { |
128 for (int i = 0; i < size; i++) { |
129 final String key = in.readUTF(); |
129 final String key = in.readUTF(); |
130 final Object value; |
130 final Object value; |