Code example for HttpsURLConnection

Methods: getInputStream, setConnectTimeout

0
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} 
		try { 
			HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
			connection.setConnectTimeout(8000);
			 
			return connection.getInputStream();
		} catch (SocketTimeoutException e) {
			throw new SocketTimeoutException();
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return null; 
	} 
 
	public InputStream getFilesSearchJsonData(String query)
			throws UnsupportedEncodingException, SocketTimeoutException { 
		URL url = null;
		try { 
			url = new URL(baseUrl + "files/search/" + URLEncoder.encode(query, "UTF-8") + "/page/-1"