LwHttp: add workaround for bug in Android image decoder (around version 4.1.2)
This commit is contained in:
parent
ddb410fea0
commit
7f41a591c8
@ -139,8 +139,23 @@ public class LwHttp {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized long skip(long n) throws IOException {
|
public synchronized long skip(long n) throws IOException {
|
||||||
sumRead += n;
|
// Android Image decoder *requires* skip to
|
||||||
return super.skip(n);
|
// actually skip the requested amout.
|
||||||
|
// https://code.google.com/p/android/issues/detail?id=6066
|
||||||
|
long sumSkipped = 0L;
|
||||||
|
while (sumSkipped < n) {
|
||||||
|
long skipped = super.skip(n - sumSkipped);
|
||||||
|
if (skipped != 0) {
|
||||||
|
sumSkipped += skipped;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (read() < 0)
|
||||||
|
break; // EOF
|
||||||
|
|
||||||
|
sumSkipped += 1;
|
||||||
|
}
|
||||||
|
sumRead += sumSkipped;
|
||||||
|
return sumSkipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user