Class AbstractASN1Reader

java.lang.Object
org.forgerock.opendj.io.AbstractASN1Reader
All Implemented Interfaces:
Closeable, AutoCloseable, ASN1Reader

public abstract class AbstractASN1Reader extends Object implements ASN1Reader
An abstract ASN1Reader which can be used as the basis for implementing new ASN1 reader implementations.
  • Constructor Details

  • Method Details

    • readBoolean

      public boolean readBoolean(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as a boolean having the provided type tag.
      Specified by:
      readBoolean in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Returns:
      The decoded boolean value.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readEnumerated

      public int readEnumerated(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an enumerated having the provided type tag.
      Specified by:
      readEnumerated in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Returns:
      The decoded enumerated value.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readInteger

      public long readInteger(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an integer having the provided type tag.
      Specified by:
      readInteger in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Returns:
      The decoded integer value.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readNull

      public void readNull(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as a null element having the provided type tag.
      Specified by:
      readNull in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readOctetString

      public ByteString readOctetString(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an octet string having the provided type tag.
      Specified by:
      readOctetString in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Returns:
      The decoded octet string represented using a ByteString.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readOctetString

      public ByteStringBuilder readOctetString(byte type, ByteStringBuilder builder) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an octet string having the provided type tag and appends it to the provided ByteStringBuilder.
      Specified by:
      readOctetString in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      builder - The ByteStringBuilder to append the octet string to.
      Returns:
      A reference to builder.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readOctetStringAsString

      public String readOctetStringAsString(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an octet string having the provided type tag and decodes the value as a UTF-8 encoded string.
      Specified by:
      readOctetStringAsString in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Returns:
      The decoded octet string as a UTF-8 encoded string.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readStartExplicitTag

      public void readStartExplicitTag(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as an explicit tag having the provided tag type. All further reads will read the elements in the explicit tag until ASN1Reader.readEndExplicitTag() is called.
      Specified by:
      readStartExplicitTag in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readStartSequence

      public void readStartSequence(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as a sequence having the provided type tag. All further reads will read the elements in the sequence until ASN1Reader.readEndSequence() is called.
      Specified by:
      readStartSequence in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Throws:
      IOException - If an unexpected IO error occurred.
    • readStartSet

      public void readStartSet(byte type) throws IOException
      Description copied from interface: ASN1Reader
      Reads the next element as a set having the provided type tag. All further reads will read the elements in the set until ASN1Reader.readEndSet() is called.
      Specified by:
      readStartSet in interface ASN1Reader
      Parameters:
      type - The expected type tag of the element.
      Throws:
      IOException - If an unexpected IO error occurred.
    • skipElement

      public ASN1Reader skipElement(byte expectedType) throws IOException
      Description copied from interface: ASN1Reader
      Skips the next element having the provided type tag without decoding it.
      Specified by:
      skipElement in interface ASN1Reader
      Parameters:
      expectedType - The expected type tag of the element.
      Returns:
      A reference to this ASN.1 reader.
      Throws:
      IOException - If an unexpected IO error occurred.