Class ViewerContext

  • Direct Known Subclasses:
    BinaryContext, TextContext

    public abstract class ViewerContext
    extends Object
    Is the abstract base class for a viewer context.

    A viewer context contains a viewer ID and data which can be displayed in a viewer in the Console. Every viewer in the Console has a corresponding viewer context class in this library. A viewer context is capable of processing data and to format them in a way so that the corresponding viewer in the Console can display it.

    Viewer contexts provide a simple way to extend the functionality of the SmartInspect Java library. See the Session.logCustomContext method for a detailed example.

    This class is not guaranteed to be threadsafe.

    • Constructor Detail

      • ViewerContext

        protected ViewerContext​(ViewerId vi)
        Creates and initializes a ViewerContext instance.
        Parameters:
        vi - The viewer ID to use
    • Method Detail

      • getViewerId

        public ViewerId getViewerId()
        Returns the viewer ID which specifies the viewer to use in the Console.
        Returns:
        The viewer ID which specifies the viewer to use in the Console
      • getViewerData

        public abstract byte[] getViewerData()
        Returns the actual data which will be displayed in the viewer specified by the getViewerId method.
        Returns:
        The actual data which will be displayed in the viewer specified by the getViewerId method
      • close

        public void close()
        Releases any resources of this viewer context.

        The default implementation does nothing. Derived classes can change this behavior by overriding this method.