Class BaseConnectionListener

  • All Implemented Interfaces:
    ConnectionListener

    public class BaseConnectionListener
    extends java.lang.Object
    implements ConnectionListener

    Adapter class implementing the ConnectionListener methods

    This is a helper class to reduce the code needed to implement the ConnectionListener interface.

    Simply extend this class and override the required methods rather than implement the full ConnectionListener interface.

    A trivial implementation would be as follows :

    import com.caplin.streamlink.BaseConnectionListener;
    import com.caplin.streamlink.ConnectionListener;
    import com.caplin.streamlink.ConnectionStatusEvent;
    import com.caplin.streamlink.StatisticsEvent;
    
    public class BaseConnectionListenerSnippet
    {
            
            public BaseConnectionListenerSnippet()
            {
                    // Define and add connection listener.
                    ConnectionListener listener = new BaseConnectionListener() {
                            
                            // Print connection status message to console.
                            @Override
                            public void onConnectionStatusChange(ConnectionStatusEvent event) {
                                    System.out.println(event.toString());
                            }
                            
                            // Print latency to console.
                            @Override
                            public void onStatisticsChange(StatisticsEvent event) {
                                    System.out.println("Latency is: " + event.getAverageLatency());
                            }
                            
                    };
            }
    }
    

    • Constructor Detail

      • BaseConnectionListener

        public BaseConnectionListener()
    • Method Detail

      • onSourceStatusChange

        public void onSourceStatusChange​(SourceStatusEvent sourceStatusEvent)
        Description copied from interface: ConnectionListener

        Invoked when the state of one of the Integration Adapters connected to Liberator changes. Implementing this method is optional.

        Specified by:
        onSourceStatusChange in interface ConnectionListener
        Parameters:
        sourceStatusEvent - The new status of the Integration Adapter.
      • onConnectionStatusChange

        public void onConnectionStatusChange​(ConnectionStatusEvent connectionStatusEvent)
        Description copied from interface: ConnectionListener

        Invoked when the state of the StreamLink connection changes. Implementing this method is optional.

        Specified by:
        onConnectionStatusChange in interface ConnectionListener
        Parameters:
        connectionStatusEvent - The new status of the connection.
      • onServiceStatusChange

        public void onServiceStatusChange​(ServiceStatusEvent serviceStatusEvent)
        Description copied from interface: ConnectionListener

        Invoked when the state of a data service available from the Liberator changes. Implementing this method is optional.

        Specified by:
        onServiceStatusChange in interface ConnectionListener
        Parameters:
        serviceStatusEvent - The new status of the data service.
      • onStatisticsChange

        public void onStatisticsChange​(StatisticsEvent statisticsEvent)
        Description copied from interface: ConnectionListener

        Invoked when new connection statistics are available. Implementing this method is optional.

        Specified by:
        onStatisticsChange in interface ConnectionListener
        Parameters:
        statisticsEvent - The new connection statistics.