APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jfr.internal.query

public final Class ViewPrinter

extends Object
Class Inheritance
Imports
java.io.Closeable, .IOException, java.text.ParseException, java.util.ArrayList, .Collections, .HashMap, .LinkedHashSet, .List, .Map, .Set, .StringJoiner, jdk.jfr.EventType, jdk.jfr.consumer.EventStream, jdk.jfr.internal.query.QueryResolver.QueryException, .ViewFile.ViewConfiguration, jdk.jfr.internal.util.Columnizer, .Output, .StopWatch, .Tokenizer, .UserDataException, .UserSyntaxException, .ValueFormatter

Class responsible for executing and displaying the contents of a query.

Used by 'jcmd JFR.view' and 'jfr view'.

Views are defined in jdk/jfr/internal/query/view.ini

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Configuration
private final Output
private final StopWatch
private final EventStream

Constructor Summary

AccessConstructor and Description
public
ViewPrinter(Configuration
display configuration
configuration
,
EventStream
a non-started stream from where data should be fetched.
stream
)

Constructs a view printer object.

Method Summary

Modifier and TypeMethod and Description
public void
execute(String
the view or event type to display
text
)

Prints the view.

public static List<String>
private static List<String>
getViewList(String selection)

private String
nextText(Tokenizer tokenizer)

private void
private void
private void
pack-priv void
private boolean
showEventType(String eventType)

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private final Configuration configuration
outback to summary
private final Output out
stopWatchback to summary
private final StopWatch stopWatch
streamback to summary
private final EventStream stream

Constructor Detail

ViewPrinterback to summary
public ViewPrinter(Configuration configuration, EventStream stream)

Constructs a view printer object.

Parameters
configuration:Configuration

display configuration

stream:EventStream

a non-started stream from where data should be fetched.

Method Detail

executeback to summary
public void execute(String text) throws UserDataException, UserSyntaxException

Prints the view.

Parameters
text:String

the view or event type to display

Exceptions
UserDataException:
if the stream associated with the printer lacks event or event metadata
UserSyntaxException:
if the syntax of the query is incorrect.
getAvailableViewsback to summary
public static List<String> getAvailableViews()
getViewListback to summary
private static List<String> getViewList(String selection)
nextTextback to summary
private String nextText(Tokenizer tokenizer) throws ParseException
printQueryback to summary
private void printQuery(ViewPrinter.LineBuilder lb, String query)
printTimespanback to summary
private void printTimespan()
printViewback to summary
private void printView(ViewFile.ViewConfiguration section, QueryRun queryRun) throws UserDataException, ParseException, UserSyntaxException
printViewTypeRelationback to summary
pack-priv void printViewTypeRelation(List<ViewFile.ViewConfiguration> views, List<EventType> eventTypes) throws ParseException
showEventTypeback to summary
private boolean showEventType(String eventType)
showViewsback to summary
private boolean showViews(String text) throws UserDataException, ParseException, UserSyntaxException
jdk.jfr.internal.query back to summary

private Class ViewPrinter.LineBuilder

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable

Field Summary

Modifier and TypeField and Description
private final Output
private int
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
LineBuilder(Output out, long width)

Method Summary

Modifier and TypeMethod and Description
public void
append(String text)

public void
close()

Implements java.io.Closeable.close.

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

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

outback to summary
private final Output out
positionback to summary
private int position
widthback to summary
private final long width

Constructor Detail

LineBuilderback to summary
pack-priv LineBuilder(Output out, long width)

Method Detail

appendback to summary
public void append(String text)
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
printback to summary
private void print(String s)