Code example for URLConnection

Methods: getInputStreamsetUseCaches

0
            return openFile(s);
        } 
        InputStream inputstream;
        try { 
            URLConnection urlconnection = url.openConnection();
            urlconnection.setUseCaches(false);
            inputstream = urlconnection.getInputStream();
        } 
        catch (IOException ioexception) {
            ioexception.printStackTrace(System.out);
            return null; 
        } 
        return inputstream;
    } 
 
    //slightly shorter StringBuffer version 
    public static synchronized String getLineFromURL(InputStream myInputStream) {
        int ch = -1;
        StringBuffer sb = new StringBuffer(256);
        while (true) { 
Stop searching for code, let great code find you!  Add Codota to your java IDE