Code example for URLConnection

Methods: connectgetContentLength

0
			 
			try{ 
			if(DBG )log("Creating connection");
			URL aurl = new URL(url);
			URLConnection conexion = aurl.openConnection();
			conexion.connect();
			if(DBG )log("Connection complete");
			 
			lengthOfFile = conexion.getContentLength();
			 
			} 
			catch(Exception e){
				lengthOfFile = -1;
				e.printStackTrace();
			} 
			 
			 
 
			if(DBG )log("Determining if files are the same");
            if((int)f.length() != lengthOfFile){
Stop searching for code, let great code find you!  Add Codota to your java IDE