Package com.aerisweather.aeris.util
Class NetworkUtils
- java.lang.Object
-
- com.aerisweather.aeris.util.NetworkUtils
-
public class NetworkUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description NetworkUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringconvertStreamToString(InputStream is)static intgetDMSDegrees(double pCoord)This method returns the degrees portion of the passed on latitude or longitude coordinate.static intgetDMSMinutes(double pCoord)This method returns the minutes portion of the passed on latitude or longitude coordinate.static intgetDMSSeconds(double pCoord)This method returns the seconds portion of the passed on latitude or longitude coordinate.static org.json.JSONObjectgetJSON(UrlBuilder builder)static org.json.JSONObjectgetJSON(URL url)static org.json.JSONObjectgetJSONZipped(UrlBuilder builder, boolean debug)static StringgetString(UrlBuilder builder)static StringgetString(URL url)static StringgetStringGSONZipped(UrlBuilder builder, boolean debug)static StringheadingToString(double x)static booleanisOnline(android.content.Context context)Checks to see whether or not we have an established connection.static booleanlaunchNetworkAsyncTask(android.os.AsyncTask<Void,Void,?> task, android.content.Context context)static android.graphics.BitmaploadBitmap(String srcUrl, int opacity)Loads the bitmap from the given src Url.
-
-
-
Field Detail
-
TAG
public static final String TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
convertStreamToString
public static String convertStreamToString(InputStream is) throws IOException
- Throws:
IOException
-
getJSONZipped
public static org.json.JSONObject getJSONZipped(UrlBuilder builder, boolean debug)
-
getStringGSONZipped
public static String getStringGSONZipped(UrlBuilder builder, boolean debug)
-
isOnline
public static boolean isOnline(android.content.Context context)
Checks to see whether or not we have an established connection. If a device, it will check for a wifi connection and network Connection- Parameters:
context- Context- Returns:
- true if connected
-
getString
public static String getString(UrlBuilder builder)
-
getJSON
public static org.json.JSONObject getJSON(URL url)
-
getJSON
public static org.json.JSONObject getJSON(UrlBuilder builder)
-
loadBitmap
public static android.graphics.Bitmap loadBitmap(String srcUrl, int opacity)
Loads the bitmap from the given src Url.- Parameters:
srcUrl- Stringopacity- int- Returns:
- Bitmap
-
headingToString
public static String headingToString(double x)
- Parameters:
x- Double Bearing- Returns:
- String Cardinal Direction
-
getDMSDegrees
public static int getDMSDegrees(double pCoord)
This method returns the degrees portion of the passed on latitude or longitude coordinate.- Parameters:
pCoord- double- Returns:
- int
-
getDMSMinutes
public static int getDMSMinutes(double pCoord)
This method returns the minutes portion of the passed on latitude or longitude coordinate.- Parameters:
pCoord- double- Returns:
- int
-
getDMSSeconds
public static int getDMSSeconds(double pCoord)
This method returns the seconds portion of the passed on latitude or longitude coordinate.- Parameters:
pCoord- double- Returns:
- int
-
-