Class Asn1Simple<T>

All Implemented Interfaces:
Asn1Type
Direct Known Subclasses:
Asn1BitString, Asn1BmpString, Asn1Boolean, Asn1Enumerated, Asn1Eoc, Asn1GeneralizedTime, Asn1Integer, Asn1IntegerEnumerated, Asn1Null, Asn1ObjectIdentifier, Asn1OctetString, Asn1String, Asn1UtcTime

public abstract class Asn1Simple<T> extends AbstractAsn1Type<T>
ASN1 simple type, of single value other than complex type of multiple values.
  • Constructor Details

    • Asn1Simple

      public Asn1Simple(UniversalTag tagNo)
      Default constructor, generally for decoding as a value container
      Parameters:
      tagNo - The tag number
    • Asn1Simple

      public Asn1Simple(UniversalTag universalTag, T value)
      Constructor with a value, generally for encoding of the value
      Parameters:
      universalTag - The tag number
      value - The value
  • Method Details

    • isDefinitiveLength

      public boolean isDefinitiveLength()
      Description copied from interface: Asn1Type
      Tells if it's definitive length or not.
      Specified by:
      isDefinitiveLength in interface Asn1Type
      Overrides:
      isDefinitiveLength in class Asn1Encodeable
      Returns:
      The boolean value
    • getBytes

      protected byte[] getBytes()
    • setBytes

      protected void setBytes(byte[] bytes)
    • encodeBody

      protected byte[] encodeBody()
    • encodeBody

      protected void encodeBody(ByteBuffer buffer)
      Overrides:
      encodeBody in class Asn1Encodeable
    • encodingBodyLength

      protected int encodingBodyLength()
      Specified by:
      encodingBodyLength in class Asn1Encodeable
    • decodeBody

      protected void decodeBody(Asn1ParseResult parseResult) throws IOException
      Specified by:
      decodeBody in class Asn1Encodeable
      Throws:
      IOException
    • toValue

      protected void toValue() throws IOException
      Throws:
      IOException
    • toBytes

      protected void toBytes()
    • isSimple

      public static boolean isSimple(Tag tag)
    • isSimple

      public static boolean isSimple(int tag)
    • isSimple

      public static boolean isSimple(UniversalTag tagNo)
    • createSimple

      public static Asn1Simple<?> createSimple(int tagNo)
      Create a simple ASN1 object given tagNo, using the default constructor with no value provided
      Parameters:
      tagNo - The tag number
      Returns:
      A simple ASN1 object
    • createSimple

      public static Asn1Simple<?> createSimple(UniversalTag tagNo)
      Create a simple ASN1 object given tagNo, using the default constructor with no value provided
      Parameters:
      tagNo - The tag number
      Returns:
      The simple ASN1 object
    • toString

      public String toString()
      Overrides:
      toString in class AbstractAsn1Type<T>