Logo Search packages:      
Sourcecode: bouncycastle version File versions  Download package

DefiniteLengthInputStream.java

package org.bouncycastle.asn1;

import java.io.InputStream;
import java.io.IOException;

class DefiniteLengthInputStream
        extends LimitedInputStream
{
    private int               _length;

    DefiniteLengthInputStream(
        InputStream in,
        int         length)
    {
        super(in);

        this._length = length;
    }

    public int read()
        throws IOException
    {
        if (_length-- > 0)
        {
            return _in.read();
        }
        else
        {
            setParentEofDetect(true);

            return -1;
        }
    }
}

Generated by  Doxygen 1.6.0   Back to index