org.apache.asn1new
Class Asn1Object

java.lang.Object
  extended by org.apache.asn1new.Asn1Object

public abstract class Asn1Object
extends java.lang.Object

An abstract class which implements basic TLV operations.

Author:
Apache Directory Project

Field Summary
private  int currentLength
          The object's current length.
private  int expectedLength
          The object's expected length.
protected  Asn1Object parent
          The encapsulating Object
 
Constructor Summary
Asn1Object()
           
 
Method Summary
 void addLength(int length)
          Add a length to the object
abstract  int computeLength()
          Compute the object length, which is the sum of all inner length.
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the object to a PDU.
 int getCurrentLength()
          Get the current object length, which is the sum of all inner length already decoded.
 int getExpectedLength()
          Get the expected object length.
 Asn1Object getParent()
          Get the parent
 void setCurrentLength(int currentLength)
          Set the current length
 void setExpectedLength(int expectedLength)
          Set the expected length
 void setParent(Asn1Object parent)
          Set the parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentLength

private transient int currentLength
The object's current length. It is used while decoding PDUs


expectedLength

private transient int expectedLength
The object's expected length. It is used while decoding PDUs


parent

protected transient Asn1Object parent
The encapsulating Object

Constructor Detail

Asn1Object

public Asn1Object()
Method Detail

getCurrentLength

public int getCurrentLength()
Get the current object length, which is the sum of all inner length already decoded.

Returns:
The current object's length

computeLength

public abstract int computeLength()
Compute the object length, which is the sum of all inner length.

Returns:
The object's computed length

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws org.apache.asn1.codec.EncoderException
Encode the object to a PDU.

Parameters:
buffer - The buffer where to put the PDU
Returns:
The PDU.
Throws:
org.apache.asn1.codec.EncoderException

getExpectedLength

public int getExpectedLength()
Get the expected object length.

Returns:
The expected object's length

addLength

public void addLength(int length)
               throws org.apache.asn1.codec.DecoderException
Add a length to the object

Parameters:
length - The length to add.
Throws:
org.apache.asn1.codec.DecoderException - Thrown if the current length exceed the expected length

setExpectedLength

public void setExpectedLength(int expectedLength)
Set the expected length

Parameters:
expectedLength - The expectedLength to set.

setCurrentLength

public void setCurrentLength(int currentLength)
Set the current length

Parameters:
currentLength - The currentLength to set.

getParent

public Asn1Object getParent()
Get the parent

Returns:
Returns the parent.

setParent

public void setParent(Asn1Object parent)
Set the parent

Parameters:
parent - The parent to set.


Copyright © 2005-2009 . All Rights Reserved.