org.apache.directory.shared.asn1.ber
Class Asn1Decoder

java.lang.Object
  extended by org.apache.directory.shared.asn1.ber.Asn1Decoder
All Implemented Interfaces:
ITLVBerDecoderMBean
Direct Known Subclasses:
CancelDecoder, CertGenerationDecoder, EntryChangeControlDecoder, GracefulDisconnectDecoder, GracefulShutdownDecoder, PagedResultsControlDecoder, PersistentSearchControlDecoder, StoredProcedureDecoder, SubentriesControlDecoder, SyncDoneValueControlDecoder, SyncInfoValueControlDecoder, SyncRequestValueControlDecoder, SyncStateValueControlDecoder

public class Asn1Decoder
extends java.lang.Object
implements ITLVBerDecoderMBean

A BER TLV Tag component decoder. This decoder instanciate 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.

Version:
$Rev: 912399 $, $Date: 2010-02-21 21:52:31 +0100 (Sun, 21 Feb 2010) $
Author:
Apache Directory Project

Constructor Summary
Asn1Decoder()
          A public constructor of an Asn1 Decoder.
 
Method Summary
 void allowIndefiniteLength()
          Allow indefinite length.
 void decode(java.nio.ByteBuffer stream, IAsn1Container container)
          The decoder main function.
 void disallowIndefiniteLength()
          Disallow indefinite length.
 int getMaxLengthLength()
          Get the length's Length.
 int getMaxTagLength()
          Get the maximum Tag's length
 boolean isIndefiniteLengthAllowed()
          Tells if indefinite length form could be used for Length
 void setMaxLengthLength(int maxLengthLength)
          Set the maximul length for a Length
 void setMaxTagLength(int maxTagLength)
          Set the maximum Tag length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asn1Decoder

public Asn1Decoder()
A public constructor of an Asn1 Decoder.

Method Detail

decode

public void decode(java.nio.ByteBuffer stream,
                   IAsn1Container 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 length's Length.

Specified by:
getMaxLengthLength in interface ITLVBerDecoderMBean
Returns:
Returns the length's Length.

getMaxTagLength

public int getMaxTagLength()
Get the maximum Tag's length

Specified by:
getMaxTagLength in interface ITLVBerDecoderMBean
Returns:
Returns the maximum tag Length.

disallowIndefiniteLength

public void disallowIndefiniteLength()
Disallow indefinite length.

Specified by:
disallowIndefiniteLength in interface ITLVBerDecoderMBean

allowIndefiniteLength

public void allowIndefiniteLength()
Allow indefinite length.

Specified by:
allowIndefiniteLength in interface ITLVBerDecoderMBean

isIndefiniteLengthAllowed

public boolean isIndefiniteLengthAllowed()
Tells if indefinite length form could be used for Length

Specified by:
isIndefiniteLengthAllowed in interface ITLVBerDecoderMBean
Returns:
Returns true if the current decoder support indefinite length

setMaxLengthLength

public void setMaxLengthLength(int maxLengthLength)
                        throws DecoderException
Set the maximul length for a Length

Specified by:
setMaxLengthLength in interface ITLVBerDecoderMBean
Parameters:
maxLengthLength - The lengthLength to set.
Throws:
DecoderException - Thrown if the indefinite length is allowed or if the length's Length is above 126 bytes

setMaxTagLength

public void setMaxTagLength(int maxTagLength)
Set the maximum Tag length

Specified by:
setMaxTagLength in interface ITLVBerDecoderMBean
Parameters:
maxTagLength - The tagLength to set.


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.