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 and Description |
---|
BaseConnectionListener() |
Modifier and Type | Method and Description |
---|---|
void |
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.
|
public void onSourceStatusChange(SourceStatusEvent sourceStatusEvent)
ConnectionListener
Invoked when the state of one of the Integration Adapters connected to Liberator changes. Implementing this method is optional.
onSourceStatusChange
in interface ConnectionListener
sourceStatusEvent
- The new status of the Integration Adapter.public void onConnectionStatusChange(ConnectionStatusEvent connectionStatusEvent)
ConnectionListener
Invoked when the state of the StreamLink connection changes. Implementing this method is optional.
onConnectionStatusChange
in interface ConnectionListener
connectionStatusEvent
- The new status of the connection.public void onServiceStatusChange(ServiceStatusEvent serviceStatusEvent)
ConnectionListener
Invoked when the state of a data service available from the Liberator changes. Implementing this method is optional.
onServiceStatusChange
in interface ConnectionListener
serviceStatusEvent
- The new status of the data service.public void onStatisticsChange(StatisticsEvent statisticsEvent)
ConnectionListener
Invoked when new connection statistics are available. Implementing this method is optional.
onStatisticsChange
in interface ConnectionListener
statisticsEvent
- The new connection statistics.Please send bug reports and comments to Caplin support