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 String
convertStreamToString(InputStream is)
static int
getDMSDegrees(double pCoord)
This method returns the degrees portion of the passed on latitude or longitude coordinate.static int
getDMSMinutes(double pCoord)
This method returns the minutes portion of the passed on latitude or longitude coordinate.static int
getDMSSeconds(double pCoord)
This method returns the seconds portion of the passed on latitude or longitude coordinate.static org.json.JSONObject
getJSON(UrlBuilder builder)
static org.json.JSONObject
getJSON(URL url)
static org.json.JSONObject
getJSONZipped(UrlBuilder builder, boolean debug)
static String
getString(UrlBuilder builder)
static String
getString(URL url)
static String
getStringGSONZipped(UrlBuilder builder, boolean debug)
static String
headingToString(double x)
static boolean
isOnline(android.content.Context context)
Checks to see whether or not we have an established connection.static boolean
launchNetworkAsyncTask(android.os.AsyncTask<Void,Void,?> task, android.content.Context context)
static android.graphics.Bitmap
loadBitmap(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
-
-