Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions core/src/processing/core/PApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4944,12 +4944,19 @@ public InputStream createInputRaw(String filename) {
// URL url = new URL(filename);
// stream = url.openStream();
// return stream;
HttpGet httpRequest = null;
httpRequest = new HttpGet(URI.create(filename));
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
return entity.getContent();
URL url = new URL(filename);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setDoInput(true);
con.connect();
return con.getInputStream();
//The following code is deprecaded by Android
// HttpGet httpRequest = null;
// httpRequest = new HttpGet(URI.create(filename));
// HttpClient httpclient = new DefaultHttpClient();
// HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
// HttpEntity entity = response.getEntity();
// return entity.getContent();
// can't use BufferedHttpEntity because it may try to allocate a byte
// buffer of the size of the download, bad when DL is 25 MB... [0200]
// BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
Expand Down