Class BerInputStream

java.lang.Object
org.apache.harmony.security.asn1.BerInputStream
Direct Known Subclasses:
DerInputStream

public class BerInputStream
extends Object
Decodes ASN.1 types encoded with BER (X.690)
See Also:
ASN.1
  • Field Details

    • buffer

      protected byte[] buffer
    • offset

      protected int offset
      The position in the buffer. Next read must place data into the buffer from this offset
    • INDEFINIT_LENGTH

      protected static final int INDEFINIT_LENGTH
      Indicates indefinite length of the current type
      See Also:
      Constant Field Values
    • tag

      public int tag
      Current decoded tag
    • length

      protected int length
      Current decoded length
    • content

      public Object content
      Current decoded content
    • tagOffset

      protected int tagOffset
      Current decoded tag offset
    • contentOffset

      protected int contentOffset
      Current decoded content offset
    • choiceIndex

      public int choiceIndex
      The last choice index
    • times

      public int[] times
      Keeps last decoded: year, month, day, hour, minute, second, millisecond
    • oidElement

      public int oidElement
    • isVerify

      protected boolean isVerify
      Indicates verify or store mode. In store mode a decoded content is stored in a newly allocated appropriate object. The content variable holds a reference to the last created object. In verify mode a decoded content is not stored.
    • isIndefinedLength

      protected boolean isIndefinedLength
      Indicates defined or indefined reading mode for associated InputStream. This mode is defined by reading a length for a first ASN.1 type from InputStream.
  • Constructor Details

    • BerInputStream

      public BerInputStream​(byte[] encoded) throws IOException
      Creates stream for decoding.
      Throws:
      IOException
    • BerInputStream

      public BerInputStream​(byte[] encoded, int offset, int expectedLength) throws IOException
      Creates stream for decoding.
      Parameters:
      encoded - bytes array to be decoded
      offset - the encoding offset
      expectedLength - expected length of full encoding, this includes identifier, length an content octets
      Throws:
      IOException
    • BerInputStream

      public BerInputStream​(InputStream in) throws IOException
      Creates stream for decoding. Allocates initial buffer of default size
      Throws:
      IOException
    • BerInputStream

      public BerInputStream​(InputStream in, int initialSize) throws IOException
      Creates stream for decoding.
      Parameters:
      initialSize - the internal buffer initial size
      Throws:
      IOException
  • Method Details