implement LwHttp.Buffer.mark()/reset()
- fixes bitmap tile loading
This commit is contained in:
@@ -110,6 +110,7 @@ public class LwHttp {
|
||||
static class Buffer extends BufferedInputStream {
|
||||
OutputStream mCache;
|
||||
int sumRead = 0;
|
||||
int marked = -1;
|
||||
int mContentLength;
|
||||
|
||||
public Buffer(InputStream is) {
|
||||
@@ -129,6 +130,20 @@ public class LwHttp {
|
||||
return sumRead == mContentLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void mark(int readlimit) {
|
||||
marked = sumRead;
|
||||
super.mark(readlimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() throws IOException {
|
||||
if (marked >= 0)
|
||||
sumRead = marked;
|
||||
// TODO could check if the mark is already invalid
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (sumRead >= mContentLength)
|
||||
|
||||
Reference in New Issue
Block a user