Class BaseConnectionListener
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onConnectionStatusChange
(ConnectionStatusEvent connectionStatusEvent) Invoked when the state of the StreamLink connection changes.void
onServiceStatusChange
(ServiceStatusEvent serviceStatusEvent) Invoked when the state of a data service available from the Liberator changes.void
onSourceStatusChange
(SourceStatusEvent sourceStatusEvent) Invoked when the state of one of the Integration Adapters connected to Liberator changes.void
onStatisticsChange
(StatisticsEvent statisticsEvent) Invoked when new connection statistics are available.
-
Constructor Details
-
BaseConnectionListener
public BaseConnectionListener()
-
-
Method Details
-
onSourceStatusChange
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 interfaceConnectionListener
- Parameters:
sourceStatusEvent
- The new status of the Integration Adapter.
-
onConnectionStatusChange
Description copied from interface:ConnectionListener
Invoked when the state of the StreamLink connection changes. Implementing this method is optional.
- Specified by:
onConnectionStatusChange
in interfaceConnectionListener
- Parameters:
connectionStatusEvent
- The new status of the connection.
-
onServiceStatusChange
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 interfaceConnectionListener
- Parameters:
serviceStatusEvent
- The new status of the data service.
-
onStatisticsChange
Description copied from interface:ConnectionListener
Invoked when new connection statistics are available. Implementing this method is optional.
- Specified by:
onStatisticsChange
in interfaceConnectionListener
- Parameters:
statisticsEvent
- The new connection statistics.
-