提交 27c466a1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Return -1 instead of 0 from RangeInputStream and RangeReader on EOF

上级 92708b80
......@@ -37,7 +37,7 @@ public final class RangeInputStream extends FilterInputStream {
@Override
public int read() throws IOException {
if (limit < 1) {
if (limit <= 0) {
return -1;
}
int b = in.read();
......@@ -49,6 +49,8 @@ public final class RangeInputStream extends FilterInputStream {
@Override
public int read(byte b[], int off, int len) throws IOException {
if (limit <= 0)
return -1;
if (len > limit) {
len = (int) limit;
}
......
......@@ -38,7 +38,7 @@ public final class RangeReader extends Reader {
@Override
public int read() throws IOException {
if (limit < 1) {
if (limit <= 0) {
return -1;
}
int c = r.read();
......@@ -50,6 +50,8 @@ public final class RangeReader extends Reader {
@Override
public int read(char cbuf[], int off, int len) throws IOException {
if (limit <= 0)
return -1;
if (len > limit) {
len = (int) limit;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论