We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在调用了request.cancel()后,表面上看起来像是取消下载了,但实质服务器还能给客户端发数据。 分析了原因,是因为DataParser中stream.close()不能立即关闭,需要接收完全部数据,inputstream才能关闭导致。这说明数据链路还是连接的,这样取消下载就没什么意义,还是会消耗流量,但我不知道怎么修改,有大牛知道怎么修改吗? public T readFromNetStream(InputStream stream, long len, String charSet) throws IOException { if (stream != null) { try { this.data = parseNetStream(stream, len, charSet); } finally { stream.close(); } } return this.data; }
The text was updated successfully, but these errors were encountered:
这样看你数据量的大小; 如果你数据小于 框架buffer size 4096 那么无法停止,如果你数据大于4096那么会在完成一波buffer后及时停止。代码如下: while (!request.isCancelledOrInterrupted() && (l = is.read(buff)) > 0) { swapStream.write(buff, 0, l); readLength += l; }
Sorry, something went wrong.
No branches or pull requests
在调用了request.cancel()后,表面上看起来像是取消下载了,但实质服务器还能给客户端发数据。
分析了原因,是因为DataParser中stream.close()不能立即关闭,需要接收完全部数据,inputstream才能关闭导致。这说明数据链路还是连接的,这样取消下载就没什么意义,还是会消耗流量,但我不知道怎么修改,有大牛知道怎么修改吗?
public T readFromNetStream(InputStream stream, long len,
String charSet) throws IOException {
if (stream != null) {
try {
this.data = parseNetStream(stream, len, charSet);
} finally {
stream.close();
}
}
return this.data;
}
The text was updated successfully, but these errors were encountered: