File tree 1 file changed +13
-6
lines changed
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) {
4944
4944
// URL url = new URL(filename);
4945
4945
// stream = url.openStream();
4946
4946
// 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();
4953
4960
// can't use BufferedHttpEntity because it may try to allocate a byte
4954
4961
// buffer of the size of the download, bad when DL is 25 MB... [0200]
4955
4962
// BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
You can’t perform that action at this time.
0 commit comments