Class Asn1Decoder

  • All Implemented Interfaces:
    TLVBerDecoderMBean

    public final class Asn1Decoder
    extends Object
    implements TLVBerDecoderMBean
    A BER TLV Tag component decoder. This decoder instantiate a Tag. The tag won't be implementations should not copy the handle to the Tag object delivered but should copy the data if they need it over the long term.
    Author:
    Apache Directory Project
    • Method Detail

      • decode

        public static void decode​(ByteBuffer stream,
                                  Asn1Container container)
                           throws DecoderException
        The decoder main function. This is where we read bytes from the stream and go through the automaton. It's an inifnite loop which stop when no more bytes are to be read. It can occurs if the ByteBuffer is exhausted or if the PDU has been fully decoded.
        Parameters:
        stream - The ByteBuffer containing the PDU to decode
        container - The container that store the state, the result and other elements.
        Throws:
        DecoderException - Thrown if anything went wrong!
      • getMaxLengthLength

        public int getMaxLengthLength()
        Get the actual maximum number of bytes that can be used to encode the Length
        Specified by:
        getMaxLengthLength in interface TLVBerDecoderMBean
        Returns:
        The maximum bytes of the Length
      • getMaxTagLength

        public int getMaxTagLength()
        Get the actual maximum number of bytes that can be used to encode the Tag
        Specified by:
        getMaxTagLength in interface TLVBerDecoderMBean
        Returns:
        The maximum length of the Tag
      • isIndefiniteLengthAllowed

        public boolean isIndefiniteLengthAllowed()
        Tell if indefinite length form could be used for Length
        Specified by:
        isIndefiniteLengthAllowed in interface TLVBerDecoderMBean
        Returns:
        true if the Indefinite form is allowed