implement LwHttp.Buffer.mark()/reset()

- fixes bitmap tile loading
This commit is contained in:
Hannes Janetzek
2014-01-25 10:04:26 +01:00
parent a739c92f4a
commit 1170e4a91a

View File

@@ -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)