de.unikassel.android.sdcframework.transmission
Class ConnectivityWrapperImpl

Package class diagram package ConnectivityWrapperImpl
java.lang.Object
  extended by de.unikassel.android.sdcframework.transmission.ConnectivityWrapperImpl
All Implemented Interfaces:
ConnectivityWrapper

public class ConnectivityWrapperImpl
extends Object
implements ConnectivityWrapper

Implementation of the connectivity wrapper.


Field Summary
private static ConnectivityWrapper instance
          The singleton instance
 
Constructor Summary
private ConnectivityWrapperImpl()
          Constructor
 
Method Summary
private static int addressFromHostName(String hostname)
          Does create an integer host address from a host name.
static ConnectivityWrapper getInstance()
          Getter for the singleton instance
 boolean isAnyConnectionAvailable(Context context)
          Test method for any available Internet connection
 boolean isNetworkConnected(Context context, int networkType)
          Test method for an available network connection
 boolean testHostReachability(Context context, String hostName)
          Does test if the host is reachable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static ConnectivityWrapper instance
The singleton instance

Constructor Detail

ConnectivityWrapperImpl

private ConnectivityWrapperImpl()
Constructor

Method Detail

getInstance

public static final ConnectivityWrapper getInstance()
Getter for the singleton instance

Returns:
the singleton instance

isNetworkConnected

public final boolean isNetworkConnected(Context context,
                                        int networkType)
Description copied from interface: ConnectivityWrapper
Test method for an available network connection

Specified by:
isNetworkConnected in interface ConnectivityWrapper
Parameters:
context - the application context
networkType - the network type
Returns:
true if the requested network type is valid and connected

testHostReachability

public final boolean testHostReachability(Context context,
                                          String hostName)
Description copied from interface: ConnectivityWrapper
Does test if the host is reachable

Specified by:
testHostReachability in interface ConnectivityWrapper
Parameters:
context - the application context
hostName - the host name to detect route to
Returns:
true if there is a route to host, false otherwise

addressFromHostName

private static final int addressFromHostName(String hostname)
Does create an integer host address from a host name.

Parameters:
hostname - the host name to get hostAdress for
Returns:
an integer representation of the host IP or -1 if not successful

isAnyConnectionAvailable

public boolean isAnyConnectionAvailable(Context context)
Description copied from interface: ConnectivityWrapper
Test method for any available Internet connection

Specified by:
isAnyConnectionAvailable in interface ConnectivityWrapper
Parameters:
context - the application context
Returns:
true if any Internet connection is available, false otherwise