[CB-3430] [CB-1413] Remove Old (2.3.3) HTTP Workaround

Cherry-picked from 2.x branch of cordova-android [01946dd4]
This commit is contained in:
Ian Clelland
2013-07-10 11:56:29 -04:00
parent cdb45cd931
commit e4559a21d7
-36
View File
@@ -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()));