org.apache.asn1.ber
Class BEREncoder

java.lang.Object
  extended by org.apache.asn1.codec.stateful.AbstractStatefulEncoder
      extended by org.apache.asn1.ber.BEREncoder
All Implemented Interfaces:
TupleEventConsumer, org.apache.asn1.codec.stateful.StatefulEncoder

public class BEREncoder
extends org.apache.asn1.codec.stateful.AbstractStatefulEncoder
implements TupleEventConsumer

A BER TLV tuple encoder. This encoder receives events via a BEREncoderCallback. Hence the callback is used to deliver events to this encoder or event consumer. The product is announced via an regular encoder event.

Author:
Apache Directory Project $Rev: 157644 $

Field Summary
private  java.nio.ByteBuffer buf
           
private static int DEFAULT_BUFSZ
           
 
Constructor Summary
BEREncoder()
          Creates a BEREncoder with the default buffer size.
BEREncoder(int bufSz)
          Creates a BEREncoder with a specific buffer size.
 
Method Summary
 void chunkedValue(Tuple tlv, java.nio.ByteBuffer chunk)
           
 void encode(java.lang.Object obj)
          Overriden encode method which does nothing but throw an exception.
 void finish(Tuple tlv)
           
 void length(Tuple tlv)
           
 void tag(Tuple tlv)
           
 
Methods inherited from class org.apache.asn1.codec.stateful.AbstractStatefulEncoder
encodeOccurred, getEncoderMonitor, setCallback, setEncoderMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFSZ

private static final int DEFAULT_BUFSZ
See Also:
Constant Field Values

buf

private java.nio.ByteBuffer buf
Constructor Detail

BEREncoder

public BEREncoder()
Creates a BEREncoder with the default buffer size.


BEREncoder

public BEREncoder(int bufSz)
Creates a BEREncoder with a specific buffer size.

Parameters:
bufSz - the size of the buffer
Method Detail

encode

public void encode(java.lang.Object obj)
Overriden encode method which does nothing but throw an exception. This has been done to prevent interference with the stream of TLV events processed by this encoder. A special BEREncoderCallback implementation is used by this class to recieve events. This callback is not the same as the callback used to inform of encode events which emits ByteBuffer objects.

Specified by:
encode in interface org.apache.asn1.codec.stateful.StatefulEncoder
Parameters:
obj - the object to encode
Throws:
java.lang.UnsupportedOperationException - every time

tag

public void tag(Tuple tlv)
Specified by:
tag in interface TupleEventConsumer

length

public void length(Tuple tlv)
Specified by:
length in interface TupleEventConsumer

chunkedValue

public void chunkedValue(Tuple tlv,
                         java.nio.ByteBuffer chunk)
Specified by:
chunkedValue in interface TupleEventConsumer

finish

public void finish(Tuple tlv)
Specified by:
finish in interface TupleEventConsumer


Copyright © 2004-2009 . All Rights Reserved.