CB-5631 Removed SimpleTrackingInputStream.read(byte[] buffer)

InputStream.read(byte[] buffer) calls InputStream.read(byte[] bytes, int
offset, int count).  As SimpleTrackingInputStream overrides both these
methods a call to SimpleTrackingInputStream.read(byte[] buffer) results
in a call to SimpleTrackingInputStream.read(byte[] bytes, int offset,
int count) - and two calls to SimpleTrackingInputStream.updateBytesRead,
so the counter bytesRead gets incremented twice for each read.
This commit is contained in:
Colin Mahoney
2014-01-09 17:20:43 +01:00
committed by Andrew Grieve
parent 3c1ff16064
commit 8374b3dd67

View File

@@ -158,11 +158,8 @@ public class FileTransfer extends CordovaPlugin {
return updateBytesRead(super.read());
}
@Override
public int read(byte[] buffer) throws IOException {
return updateBytesRead(super.read(buffer));
}
// Note: FilterInputStream delegates read(byte[] bytes) to the below method,
// so we don't override it or else double count (CB-5631).
@Override
public int read(byte[] bytes, int offset, int count) throws IOException {
return updateBytesRead(super.read(bytes, offset, count));