Top Description Fields Constructors Methods
jdk.jfr.internal.consumer.filter

public final Class ChunkWriter

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .IOException, java.nio.file.Files, .Path, java.util.ArrayDeque, .Deque, java.util.function.Predicate, jdk.jfr.consumer.RecordedEvent, jdk.jfr.internal.LongMap, .Type, .Logger, .LogLevel, .LogTag, jdk.jfr.internal.consumer.ChunkHeader, .FileAccess, .RecordingInput, .Reference

Class that can filter out events and associated constants from a recording file.

All positional values are relative to file start, not the chunk.

Field Summary

Modifier and TypeField and Description
private final Deque<CheckpointEvent>
private boolean
private long
private final Path
private final Predicate<RecordedEvent>
private final RecordingInput
private long
private final RecordingOutput
private LongMap<Constants>

Constructor Summary

AccessConstructor and Description
public
ChunkWriter(Path source, Path destination, Predicate<RecordedEvent> filter)

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public void
public RecordingInput
pack-priv Constants
getPool(Type type)

public CheckpointEvent
newCheckpointEvent(long startPosition)

public void
touch(Object object)

private void
private void
updateHeader(long size, long constantPosition, long metadataPosition)

public void
write(long startPosition, long endPosition)

private void
write(CheckpointEvent event, long delta)

private void
writeCheckpointEvents(long before)

public void
writeEvent(long startPosition, long endPosition)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkpointsback to summary
private final Deque<CheckpointEvent> checkpoints
chunkCompleteback to summary
private boolean chunkComplete
chunkStartPositionback to summary
private long chunkStartPosition
destinationback to summary
private final Path destination
filterback to summary
private final Predicate<RecordedEvent> filter
inputback to summary
private final RecordingInput input
lastCheckpointback to summary
private long lastCheckpoint
outputback to summary
private final RecordingOutput output
poolsback to summary
private LongMap<Constants> pools

Constructor Detail

ChunkWriterback to summary
public ChunkWriter(Path source, Path destination, Predicate<RecordedEvent> filter) throws IOException

Method Detail

acceptback to summary
public boolean accept(RecordedEvent event)
beginChunkback to summary
public void beginChunk(ChunkHeader header) throws IOException
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
endChunkback to summary
public void endChunk(ChunkHeader header) throws IOException
getInputback to summary
public RecordingInput getInput()
getPoolback to summary
pack-priv Constants getPool(Type type)
newCheckpointEventback to summary
public CheckpointEvent newCheckpointEvent(long startPosition)
touchback to summary
public void touch(Object object)
touchRefback to summary
private void touchRef(Reference ref)
updateHeaderback to summary
private void updateHeader(long size, long constantPosition, long metadataPosition) throws IOException
writeback to summary
public void write(long startPosition, long endPosition) throws IOException
writeback to summary
private void write(CheckpointEvent event, long delta) throws IOException
writeCheckpointEventsback to summary
private void writeCheckpointEvents(long before) throws IOException
writeEventback to summary
public void writeEvent(long startPosition, long endPosition) throws IOException
writeMetadataEventback to summary
private void writeMetadataEvent(ChunkHeader header) throws IOException