use LwHttp.Buffer to set limit on InputStream

This commit is contained in:
Hannes Janetzek
2014-01-20 22:43:57 +01:00
parent 9ed4bb6ec5
commit 402cbe7e57
10 changed files with 79 additions and 81 deletions

View File

@@ -116,9 +116,9 @@ public class LwHttp {
if (status == 200) {
Uint8Array buf = Uint8ArrayNative.create(xhr.getResponseArrayBuffer());
mDataSource.process(new Buffer(buf), buf.byteLength());
mDataSource.process(new Buffer(buf));
} else {
mDataSource.process(null, -1);
mDataSource.process(null);
}
}
}

View File

@@ -57,12 +57,12 @@ public abstract class UrlTileDataSource implements ITileDataSource {
return result;
}
public void process(InputStream is, int length) {
public void process(InputStream is) {
boolean win = false;
if (length >= 0) {
if (is != null) {
try {
win = mTileDecoder.decode(mTile, mSink, is, length);
win = mTileDecoder.decode(mTile, mSink, is);
} catch (IOException e) {
e.printStackTrace();
}