org.apache.directory.shared.asn1.codec.stateful
Class AbstractStatefulEncoder

java.lang.Object
  extended by org.apache.directory.shared.asn1.codec.stateful.AbstractStatefulEncoder
All Implemented Interfaces:
StatefulEncoder

public abstract class AbstractStatefulEncoder
extends java.lang.Object
implements StatefulEncoder

Convenience class to not have to reimplement the two setter methods everytime one starts a new encoder.

Version:
$Rev: 437004 $
Author:
Apache Directory Project

Constructor Summary
AbstractStatefulEncoder()
          Creates a stateful encoder where the callback and monitor must be set.
AbstractStatefulEncoder(EncoderCallback cb)
          Creates a stateful encoder with a callback.
AbstractStatefulEncoder(EncoderCallback cb, EncoderMonitor monitor)
          Creates a stateful encoder.
AbstractStatefulEncoder(EncoderMonitor monitor)
          Creates a stateful encoder with a monitor but no callback.
 
Method Summary
protected  void encodeOccurred(java.lang.Object encoded)
          Notifies via the callback if one has been set that this encoder has encoded a unit of encoded data.
protected  EncoderMonitor getEncoderMonitor()
          Gets the encoder's monitor.
 void setCallback(EncoderCallback cb)
          Sets the callback of the underlying implementation.
 void setEncoderMonitor(EncoderMonitor monitor)
          Sets the monitor of the underlying implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.asn1.codec.stateful.StatefulEncoder
encode
 

Constructor Detail

AbstractStatefulEncoder

public AbstractStatefulEncoder()
Creates a stateful encoder where the callback and monitor must be set.


AbstractStatefulEncoder

public AbstractStatefulEncoder(EncoderCallback cb)
Creates a stateful encoder with a callback.

Parameters:
cb - the callback to use for this encoder

AbstractStatefulEncoder

public AbstractStatefulEncoder(EncoderMonitor monitor)
Creates a stateful encoder with a monitor but no callback.

Parameters:
monitor - the monitor to use for this encoder

AbstractStatefulEncoder

public AbstractStatefulEncoder(EncoderCallback cb,
                               EncoderMonitor monitor)
Creates a stateful encoder.

Parameters:
cb - the callback to use for this encoder
monitor - the monitor to use for this encoder
Method Detail

setCallback

public void setCallback(EncoderCallback cb)
Description copied from interface: StatefulEncoder
Sets the callback of the underlying implementation. There is no need for any special callbacks because when encoding we do not need to transform before a value return as we did in the decoder.

Specified by:
setCallback in interface StatefulEncoder
Parameters:
cb - the callback to set on the underlying provider specific encoder

setEncoderMonitor

public void setEncoderMonitor(EncoderMonitor monitor)
Description copied from interface: StatefulEncoder
Sets the monitor of the underlying implementation.

Specified by:
setEncoderMonitor in interface StatefulEncoder
Parameters:
monitor - the monitor to set on the underlying implementation

encodeOccurred

protected void encodeOccurred(java.lang.Object encoded)
Notifies via the callback if one has been set that this encoder has encoded a unit of encoded data.

Parameters:
encoded - the encoded byproduct.

getEncoderMonitor

protected EncoderMonitor getEncoderMonitor()
Gets the encoder's monitor.

Returns:
the monitor for this StatefulEncoder


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