MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / generate

Method generate

test/test/alloc/MapReader.java:27–38  ·  view source on GitHub ↗
(int size)

Source from the content-addressed store, hash-verified

25 }
26
27 private static byte[] generate(int size) throws IOException {
28 ByteArrayOutputStream out = new ByteArrayOutputStream(size * 17);
29 for (int i = 0; i < size; i++) {
30 int length = ThreadLocalRandom.current().nextInt(1, 9);
31 byte[] b = new byte[length];
32 ThreadLocalRandom.current().nextBytes(b);
33 String key = Base64.getEncoder().encodeToString(b);
34 long value = ThreadLocalRandom.current().nextLong(1000000);
35 out.write((key + ": " + value + "\n").getBytes(StandardCharsets.ISO_8859_1));
36 }
37 return out.toByteArray();
38 }
39
40 public Map<String, Long> readMap(InputStream in) throws IOException {
41 Map<String, Long> map = new HashMap<>();

Callers 1

MapReaderMethod · 0.95

Calls 3

currentMethod · 0.80
getBytesMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected