File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -4944,12 +4944,19 @@ public InputStream createInputRaw(String filename) {
49444944// URL url = new URL(filename);
49454945// stream = url.openStream();
49464946// return stream;
4947- HttpGet httpRequest = null ;
4948- httpRequest = new HttpGet (URI .create (filename ));
4949- HttpClient httpclient = new DefaultHttpClient ();
4950- HttpResponse response = (HttpResponse ) httpclient .execute (httpRequest );
4951- HttpEntity entity = response .getEntity ();
4952- return entity .getContent ();
4947+ URL url = new URL (filename );
4948+ HttpURLConnection con = (HttpURLConnection ) url .openConnection ();
4949+ con .setRequestMethod ("GET" );
4950+ con .setDoInput (true );
4951+ con .connect ();
4952+ return con .getInputStream ();
4953+ //The following code is deprecaded by Android
4954+ // HttpGet httpRequest = null;
4955+ // httpRequest = new HttpGet(URI.create(filename));
4956+ // HttpClient httpclient = new DefaultHttpClient();
4957+ // HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
4958+ // HttpEntity entity = response.getEntity();
4959+ // return entity.getContent();
49534960 // can't use BufferedHttpEntity because it may try to allocate a byte
49544961 // buffer of the size of the download, bad when DL is 25 MB... [0200]
49554962// BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
You can’t perform that action at this time.
0 commit comments