mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
FixedLengthInputStream - implement skip which honors mLength
Patch by andrewgaul
This commit is contained in:
parent
e145a621c7
commit
798d6753dd
@ -57,6 +57,15 @@ public class FixedLengthInputStream extends InputStream {
|
|||||||
return read(b, 0, b.length);
|
return read(b, 0, b.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long skip(long n) throws IOException {
|
||||||
|
long d = mIn.skip(Math.min(n, available()));
|
||||||
|
if (d > 0) {
|
||||||
|
mCount += d;
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength);
|
return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength);
|
||||||
|
Loading…
Reference in New Issue
Block a user