org.bouncycastle.asn1

## Class ASN1InputStream

- java.lang.Object
- - java.io.InputStream
  - - java.io.FilterInputStream
    - - org.bouncycastle.asn1.ASN1InputStream

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, BERTags

      public class ASN1InputStream
      extends java.io.FilterInputStream
      implements BERTags

  A general purpose ASN.1 decoder - note: this class differs from the others in that it returns null after it has read the last object in the stream. If an ASN.1 NULL is encountered a DER/BER Null object is returned.

- - ### Field Summary

    - ### Fields inherited from class java.io.FilterInputStream

      `in`

    - ### Fields inherited from interface org.bouncycastle.asn1.BERTags

      `APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CONSTRUCTED, CONTEXT_SPECIFIC, DATE, DATE_TIME, DURATION, EMBEDDED_PDV, ENUMERATED, EXTERNAL, FLAGS, GENERAL_STRING, GENERALIZED_TIME, GRAPHIC_STRING, IA5_STRING, INTEGER, NULL, NUMERIC_STRING, OBJECT_DESCRIPTOR, OBJECT_IDENTIFIER, OBJECT_IDENTIFIER_IRI, OCTET_STRING, PRINTABLE_STRING, PRIVATE, REAL, RELATIVE_OID, RELATIVE_OID_IRI, SEQUENCE, SEQUENCE_OF, SET, SET_OF, T61_STRING, TAGGED, TIME, TIME_OF_DAY, UNIVERSAL, UNIVERSAL_STRING, UNRESTRICTED_STRING, UTC_TIME, UTF8_STRING, VIDEOTEX_STRING, VISIBLE_STRING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ASN1InputStream(byte[] input)` Create an ASN1InputStream based on the input byte array.
    `ASN1InputStream(byte[] input, boolean lazyEvaluate)` Create an ASN1InputStream based on the input byte array.
    `ASN1InputStream(java.io.InputStream is)`
    `ASN1InputStream(java.io.InputStream input, boolean lazyEvaluate)` Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily.
    `ASN1InputStream(java.io.InputStream input, int limit)` Create an ASN1InputStream where no DER object will be longer than limit.
    `ASN1InputStream(java.io.InputStream input, int limit, boolean lazyEvaluate)` Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ASN1Primitive` | `buildObject(int tag, int tagNo, int length)` build an object given its tag and the number of bytes to construct it from.
    `protected int` | `getLimit()`
    `protected void` | `readFully(byte[] bytes)` Deprecated. No longer used; will be removed
    `protected int` | `readLength()` Deprecated. No longer used; will be removed
    `ASN1Primitive` | `readObject()`

    - ### Methods inherited from class java.io.FilterInputStream

      `available, close, mark, markSupported, read, read, read, reset, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ASN1InputStream

          public ASN1InputStream(java.io.InputStream is)

    - #### ASN1InputStream

          public ASN1InputStream(byte[] input)

      Create an ASN1InputStream based on the input byte array. The length of DER objects in the stream is automatically limited to the length of the input array.
      Parameters:
        `input` - array containing ASN.1 encoded data.

    - #### ASN1InputStream

          public ASN1InputStream(byte[] input,
                                 boolean lazyEvaluate)

      Create an ASN1InputStream based on the input byte array. The length of DER objects in the stream is automatically limited to the length of the input array.
      Parameters:
        `input` - array containing ASN.1 encoded data.
        `lazyEvaluate` - true if parsing inside constructed objects can be delayed.

    - #### ASN1InputStream

          public ASN1InputStream(java.io.InputStream input,
                                 int limit)

      Create an ASN1InputStream where no DER object will be longer than limit.
      Parameters:
        `input` - stream containing ASN.1 encoded data.
        `limit` - maximum size of a DER encoded object.

    - #### ASN1InputStream

          public ASN1InputStream(java.io.InputStream input,
                                 boolean lazyEvaluate)

      Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily.
      Parameters:
        `input` - stream containing ASN.1 encoded data.
        `lazyEvaluate` - true if parsing inside constructed objects can be delayed.

    - #### ASN1InputStream

          public ASN1InputStream(java.io.InputStream input,
                                 int limit,
                                 boolean lazyEvaluate)

      Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily.
      Parameters:
        `input` - stream containing ASN.1 encoded data.
        `limit` - maximum size of a DER encoded object.
        `lazyEvaluate` - true if parsing inside constructed objects can be delayed.

  - ### Method Detail

    - #### getLimit

          protected int getLimit()

    - #### readLength

          protected int readLength()
                            throws java.io.IOException

      Deprecated. No longer used; will be removed
      Throws:
        `java.io.IOException`

    - #### readFully

          protected void readFully(byte[] bytes)
                            throws java.io.IOException

      Deprecated. No longer used; will be removed
      Throws:
        `java.io.IOException`

    - #### buildObject

          protected ASN1Primitive buildObject(int tag,
                                              int tagNo,
                                              int length)
                                       throws java.io.IOException

      build an object given its tag and the number of bytes to construct it from.
      Parameters:
        `tag` - the full tag details.
        `tagNo` - the tagNo defined.
        `length` - the length of the object.
      Returns:
        the resulting primitive.
      Throws:
        `java.io.IOException` - on processing exception.

    - #### readObject

          public ASN1Primitive readObject()
                                   throws java.io.IOException

      Throws:
        `java.io.IOException`