Class ASN1

java.lang.Object
org.forgerock.opendj.io.ASN1

public final class ASN1 extends Object
This class contains various static factory methods for creating ASN.1 readers and writers.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    The byte array containing the pre-encoded ASN.1 encoding for a boolean value of "false".
    static final byte
    The byte array containing the pre-encoded ASN.1 encoding for a boolean value of "false".
    static final int
    The ASN.1 element decoding state that indicates that the next byte read should be additional bytes of a multi-byte length.
    static final int
    The ASN.1 element decoding state that indicates that the next byte read should be the first byte for the element length.
    static final int
    The ASN.1 element decoding state that indicates that the next byte read should be the BER type for a new element.
    static final int
    The ASN.1 element decoding state that indicates that the next byte read should be applied to the value of the element.
    static final byte
    The bitmask that can be ANDed with the BER type to determine if the element is constructed.
    static final byte
    The bitmask that can be ANDed with the BER type to determine if the element is in the context-specific class.
    static final byte
    The BER type that is assigned to the universal bit string type.
    static final byte
    The BER type that is assigned to the universal Boolean element.
    static final byte
    The BER type that is assigned to the universal enumerated type.
    static final byte
    The BER type that is assigned to the universal integer type.
    static final byte
    The BER type that is assigned to the universal null type.
    static final byte
    The BER type that is assigned to the universal octet string type.
    static final byte
    The BER type that is assigned to the universal sequence type.
    static final byte
    The BER type that is assigned to the universal set type.
  • Method Summary

    Modifier and Type
    Method
    Description
    static ASN1Reader
    getReader(byte[] array)
    Returns an ASN.1 reader whose source is the provided byte array and having an unlimited maximum BER element size.
    static ASN1Reader
    getReader(byte[] array, int maxElementSize)
    Returns an ASN.1 reader whose source is the provided byte array and having a user defined maximum BER element size.
    static ASN1Reader
    Returns an ASN.1 reader whose source is the provided input stream and having an unlimited maximum BER element size.
    static ASN1Reader
    getReader(InputStream stream, int maxElementSize)
    Returns an ASN.1 reader whose source is the provided input stream and having a user defined maximum BER element size.
    static ASN1Reader
    Returns an ASN.1 reader whose source is the provided byte sequence and having an unlimited maximum BER element size.
    static ASN1Reader
    getReader(ByteSequence sequence, int maxElementSize)
    Returns an ASN.1 reader whose source is the provided byte sequence and having a user defined maximum BER element size.
    static ASN1Reader
    Returns an ASN.1 reader whose source is the provided byte sequence reader and having an unlimited maximum BER element size.
    static ASN1Reader
    getReader(ByteSequenceReader reader, int maxElementSize)
    Returns an ASN.1 reader whose source is the provided byte sequence reader and having a user defined maximum BER element size.
    static ASN1Writer
    Returns an ASN.1 writer whose destination is the provided output stream.
    static ASN1Writer
    getWriter(OutputStream stream, int maxBufferSize)
    Returns an ASN.1 writer whose destination is the provided output stream.
    static ASN1Writer
    Returns an ASN.1 writer whose destination is the provided byte string builder.
    static ASN1Writer
    getWriter(ByteStringBuilder builder, int maxBufferSize)
    Returns an ASN.1 writer whose destination is the provided byte string builder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getReader

      public static ASN1Reader getReader(byte[] array)
      Returns an ASN.1 reader whose source is the provided byte array and having an unlimited maximum BER element size.
      Parameters:
      array - The byte array to use.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(byte[] array, int maxElementSize)
      Returns an ASN.1 reader whose source is the provided byte array and having a user defined maximum BER element size.
      Parameters:
      array - The byte array to use.
      maxElementSize - The maximum BER element size, or 0 to indicate that there is no limit.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(ByteSequence sequence)
      Returns an ASN.1 reader whose source is the provided byte sequence and having an unlimited maximum BER element size.
      Parameters:
      sequence - The byte sequence to use.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(ByteSequence sequence, int maxElementSize)
      Returns an ASN.1 reader whose source is the provided byte sequence and having a user defined maximum BER element size.
      Parameters:
      sequence - The byte sequence to use.
      maxElementSize - The maximum BER element size, or 0 to indicate that there is no limit.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(ByteSequenceReader reader)
      Returns an ASN.1 reader whose source is the provided byte sequence reader and having an unlimited maximum BER element size.
      Parameters:
      reader - The byte sequence reader to use.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(ByteSequenceReader reader, int maxElementSize)
      Returns an ASN.1 reader whose source is the provided byte sequence reader and having a user defined maximum BER element size.
      Parameters:
      reader - The byte sequence reader to use.
      maxElementSize - The maximum BER element size, or 0 to indicate that there is no limit.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(InputStream stream)
      Returns an ASN.1 reader whose source is the provided input stream and having an unlimited maximum BER element size.
      Parameters:
      stream - The input stream to use.
      Returns:
      The new ASN.1 reader.
    • getReader

      public static ASN1Reader getReader(InputStream stream, int maxElementSize)
      Returns an ASN.1 reader whose source is the provided input stream and having a user defined maximum BER element size.
      Parameters:
      stream - The input stream to use.
      maxElementSize - The maximum BER element size, or 0 to indicate that there is no limit.
      Returns:
      The new ASN.1 reader.
    • getWriter

      public static ASN1Writer getWriter(ByteStringBuilder builder)
      Returns an ASN.1 writer whose destination is the provided byte string builder.
      Parameters:
      builder - The byte string builder to use.
      Returns:
      The new ASN.1 writer.
    • getWriter

      public static ASN1Writer getWriter(ByteStringBuilder builder, int maxBufferSize)
      Returns an ASN.1 writer whose destination is the provided byte string builder.
      Parameters:
      builder - The output stream to use.
      maxBufferSize - The threshold capacity beyond which internal cached buffers used for encoding and decoding ASN1 will be trimmed after use.
      Returns:
      The new ASN.1 writer.
    • getWriter

      public static ASN1Writer getWriter(OutputStream stream)
      Returns an ASN.1 writer whose destination is the provided output stream.
      Parameters:
      stream - The output stream to use.
      Returns:
      The new ASN.1 writer.
    • getWriter

      public static ASN1Writer getWriter(OutputStream stream, int maxBufferSize)
      Returns an ASN.1 writer whose destination is the provided output stream.
      Parameters:
      stream - The output stream to use.
      maxBufferSize - The threshold capacity beyond which internal cached buffers used for encoding and decoding ASN1 will be trimmed after use.
      Returns:
      The new ASN.1 writer.