01: package org.bouncycastle.sasn1;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05:
06: class DefiniteLengthInputStream extends LimitedInputStream {
07: private int _length;
08:
09: DefiniteLengthInputStream(InputStream in, int length) {
10: super (in);
11:
12: this ._length = length;
13: }
14:
15: public int read() throws IOException {
16: if (_length-- > 0) {
17: return _in.read();
18: } else {
19: setParentEofDetect(true);
20:
21: return -1;
22: }
23: }
24: }
|