equal
deleted
inserted
replaced
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 |
39 import java.util.ArrayList; |
39 import java.util.ArrayList; |
40 import java.util.Deque; |
40 import java.util.Deque; |
41 import java.util.List; |
41 import java.util.List; |
42 |
42 |
43 import jdk.jfr.internal.consumer.ChunkHeader; |
43 import jdk.jfr.internal.consumer.ChunkHeader; |
|
44 import jdk.jfr.internal.consumer.FileAccess; |
44 import jdk.jfr.internal.consumer.RecordingInput; |
45 import jdk.jfr.internal.consumer.RecordingInput; |
45 |
46 |
46 final class Disassemble extends Command { |
47 final class Disassemble extends Command { |
47 |
48 |
48 @Override |
49 @Override |
161 throw new UserDataException("no JFR chunks found in file."); |
162 throw new UserDataException("no JFR chunks found in file."); |
162 } |
163 } |
163 } |
164 } |
164 |
165 |
165 private List<Long> findChunkSizes(Path p) throws IOException { |
166 private List<Long> findChunkSizes(Path p) throws IOException { |
166 try (RecordingInput input = new RecordingInput(p.toFile())) { |
167 try (RecordingInput input = new RecordingInput(p.toFile(), FileAccess.UNPRIVILIGED)) { |
167 List<Long> sizes = new ArrayList<>(); |
168 List<Long> sizes = new ArrayList<>(); |
168 ChunkHeader ch = new ChunkHeader(input); |
169 ChunkHeader ch = new ChunkHeader(input); |
169 sizes.add(ch.getSize()); |
170 sizes.add(ch.getSize()); |
170 while (!ch.isLastChunk()) { |
171 while (!ch.isLastChunk()) { |
171 ch = ch.nextHeader(); |
172 ch = ch.nextHeader(); |