Add the ability to change the clampedLength in LengthClampedInputStream.
This commit is contained in:
parent
aab4fdd8fa
commit
e3f294c090
@ -130,4 +130,17 @@ public class LengthClampedInputStream extends FilterInputStream {
|
|||||||
if (!closed) closed = true;
|
if (!closed) closed = true;
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new clamped length value.
|
||||||
|
* This is the maximum number of bytes that can be read from the stream.
|
||||||
|
*
|
||||||
|
* @param clampedLength The new clamped length value.
|
||||||
|
* @throws IllegalArgumentException clampedLength is less than 0.
|
||||||
|
*/
|
||||||
|
public synchronized void setClampedLength(int clampedLength) {
|
||||||
|
if (clampedLength < 0) throw new IllegalArgumentException("clampedLength is less than 0");
|
||||||
|
if (closed) return;
|
||||||
|
this.clampedLength = clampedLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user