The following example shows how to read and print all events in a recording file.
try (RecordingFile recordingFile = new RecordingFile(Paths.get("recording.jfr"))) { while (recordingFile.hasMoreEvents()) { RecordedEvent event = recordingFile.readEvent(); System.out.println(event); } }
| Modifier and Type | Field and Description |
|---|---|
| private ChunkParser | |
| private final ChunkWriter | |
| private boolean | |
| private final File | |
| private RecordingInput | |
| private boolean | |
| private RecordedEvent | |
| private final ParserState |
| Access | Constructor and Description |
|---|---|
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static MetadataDescriptor | aggregateEventTypeForChunk(ChunkHeader ch, MetadataDescriptor previous, List<EventType> types, HashSet<Long> foundIds)
|
| private MetadataDescriptor | aggregateTypeForChunk(ChunkHeader ch, MetadataDescriptor previous, List<Type> types, HashSet<Long> foundIds)
|
| public void | close()
Implements java. Closes this recording file and releases any system resources that are associated with it. |
| private ChunkParser | |
| private void | |
| private void | |
| private void | |
| pack-priv File | |
| public boolean | Returns: true if unread events exist in the recording, false
otherwise.Returns |
| pack-priv boolean | |
| private ChunkParser | |
| public static List | Returns: the events from the file as aList object; whether the
List is modifiable or not is implementation dependent and
therefore not specified, not nullthe path to the file, not path)nullReturns a list of all events in a file. |
| public RecordedEvent | |
| public List | Returns: a list of event types, notnullReturns a list of all event types in this recording. |
| pack-priv List | |
| public void | write(Path
path where the new file should be written, not
destination, Predicate<RecordedEvent> nullfilter that determines if an event should be included, not
filter)nullFilter out events and write them to a new file. |
| pack-priv List |
| chunkParser | back to summary |
|---|---|
| private ChunkParser chunkParser | |
| chunkWriter | back to summary |
|---|---|
| private final ChunkWriter chunkWriter | |
| eof | back to summary |
|---|---|
| private boolean eof | |
| file | back to summary |
|---|---|
| private final File file | |
| input | back to summary |
|---|---|
| private RecordingInput input | |
| isLastEventInChunk | back to summary |
|---|---|
| private boolean isLastEventInChunk | |
| nextEvent | back to summary |
|---|---|
| private RecordedEvent nextEvent | |
| parserState | back to summary |
|---|---|
| private final ParserState parserState | |
| RecordingFile | back to summary |
|---|---|
| public RecordingFile(Path file) throws IOException Creates a recording file. Only recording files from trusted sources should be used.
| |
| RecordingFile | back to summary |
|---|---|
| private RecordingFile(ChunkWriter chunkWriter) throws IOException | |
| aggregateEventTypeForChunk | back to summary |
|---|---|
| private static MetadataDescriptor aggregateEventTypeForChunk(ChunkHeader ch, MetadataDescriptor previous, List<EventType> types, HashSet<Long> foundIds) throws IOException | |
| aggregateTypeForChunk | back to summary |
|---|---|
| private MetadataDescriptor aggregateTypeForChunk(ChunkHeader ch, MetadataDescriptor previous, List<Type> types, HashSet<Long> foundIds) throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Closes this recording file and releases any system resources that are associated with it.
| |
| createChunkParser | back to summary |
|---|---|
| private ChunkParser createChunkParser() throws IOException | |
| endChunkParser | back to summary |
|---|---|
| private void endChunkParser() throws IOException | |
| ensureOpen | back to summary |
|---|---|
| private void ensureOpen() throws IOException | |
| findNext | back to summary |
|---|---|
| private void findNext() throws IOException | |
| getFile | back to summary |
|---|---|
| pack-priv File getFile() | |
| hasMoreEvents | back to summary |
|---|---|
| public boolean hasMoreEvents() Returns
| |
| isLastEventInChunk | back to summary |
|---|---|
| pack-priv boolean isLastEventInChunk() | |
| nextChunkParser | back to summary |
|---|---|
| private ChunkParser nextChunkParser() throws IOException | |
| readAllEvents | back to summary |
|---|---|
| public static List Returns a list of all events in a file. This method is intended for simple cases where it's convenient to read all events in a single operation. It isn't intended for reading large files. Only recording files from trusted sources should be used.
| |
| readEvent | back to summary |
|---|---|
| public RecordedEvent readEvent() throws IOException Reads the next event in the recording.
| |
| readEventTypes | back to summary |
|---|---|
| public List Returns a list of all event types in this recording.
| |
| readTypes | back to summary |
|---|---|
| pack-priv List | |
| write | back to summary |
|---|---|
| public void write(Path destination, Predicate<RecordedEvent> filter) throws IOException Filter out events and write them to a new file.
| |
| write | back to summary |
|---|---|
| pack-priv List | |