From e4559a21d724b497ab685f869043ff1d3577dc64 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Wed, 10 Jul 2013 11:56:29 -0400 Subject: [PATCH] [CB-3430] [CB-1413] Remove Old (2.3.3) HTTP Workaround Cherry-picked from 2.x branch of cordova-android [01946dd4] --- src/android/FileTransfer.java | 36 ----------------------------------- 1 file changed, 36 deletions(-) diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java index 94de97a..c24f73d 100644 --- a/src/android/FileTransfer.java +++ b/src/android/FileTransfer.java @@ -179,39 +179,6 @@ public class FileTransfer extends CordovaPlugin { } } - /** - * Works around a bug on Android 2.3. - * http://code.google.com/p/android/issues/detail?id=14562 - */ - private static final class DoneHandlerInputStream extends TrackingHTTPInputStream { - private boolean done; - - public DoneHandlerInputStream(InputStream stream) { - super(stream); - } - - @Override - public int read() throws IOException { - int result = done ? -1 : super.read(); - done = (result == -1); - return result; - } - - @Override - public int read(byte[] buffer) throws IOException { - int result = done ? -1 : super.read(buffer); - done = (result == -1); - return result; - } - - @Override - public int read(byte[] bytes, int offset, int count) throws IOException { - int result = done ? -1 : super.read(bytes, offset, count); - done = (result == -1); - return result; - } - } - @Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if (action.equals("upload") || action.equals("download")) { @@ -566,9 +533,6 @@ public class FileTransfer extends CordovaPlugin { } private static TrackingInputStream getInputStream(URLConnection conn) throws IOException { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { - return new DoneHandlerInputStream(conn.getInputStream()); - } String encoding = conn.getContentEncoding(); if (encoding != null && encoding.equalsIgnoreCase("gzip")) { return new TrackingGZIPInputStream(new ExposedGZIPInputStream(conn.getInputStream()));