Code example for URL

Methods: openStream

0
        } 
    } 
     
    private JSONObject getJson(String urlString) {
        try { 
            URL url = new URL(urlString);
            InputStream is = url.openStream();
            try { 
                String s = ParsingUtilities.inputStreamToString(is);
                return ParsingUtilities.evaluateJsonStringToObject(s);
            } finally { 
                is.close();
            } 
        } catch (IOException e) {
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } catch (JSONException e) {
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } 
        return null;