public final class MessageEncoder extends Object implements ProviderEncoder
Constructor and Description |
---|
MessageEncoder()
Creates a MessageEncoder using default properties for enabling a BER
library provider.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(Object obj)
Encodes a Message object piece by piece often emitting chunks of the
final PDU to the callback if present.
|
ByteBuffer |
encodeBlocking(Object obj)
Encodes a compiler stub specific ASN.1 message envelope containment tree
into byte array.
|
void |
encodeBlocking(Object lock,
OutputStream out,
Object obj)
Encodes a compiler stub specific ASN.1 message envelope containment tree
onto an output stream.
|
Provider |
getProvider()
Gets the Provider associated with this SPI implementation object.
|
void |
setCallback(EncoderCallback cb)
Sets the callback of the underlying implementation.
|
void |
setEncoderMonitor(EncoderMonitor monitor)
Sets the monitor of the underlying implementation.
|
public MessageEncoder() throws MessageException
MessageException
- if the encoder cannot be created.public void encodeBlocking(Object lock, OutputStream out, Object obj) throws ProviderException
ProviderEncoder
encodeBlocking
in interface ProviderEncoder
lock
- lock object used to exclusively write to the output streamout
- the OutputStream to encode the message envelope onto.obj
- the top-level message envelope stub instance, i.e. for the
Snacc4J service provider this would be an instance of the
LDAPMessage compiler generated stub class.ProviderException
- to indicate an error while attempting to encode the message
envelope onto the output stream. Provider specific exceptions
encountered while encoding can be held within this subclass
of MultiException.ProviderEncoder.encodeBlocking(Object, java.io.OutputStream, Object)
public ByteBuffer encodeBlocking(Object obj) throws ProviderException
ProviderEncoder
encodeBlocking
in interface ProviderEncoder
obj
- the top-level message envelope stub instance, i.e. for the
Snacc4J service provider this would be an instance of the
LDAPMessage compiler generated stub class.ProviderException
- to indicate an error while attempting to encode the message
envelope into a byte buffer. Provider specific exceptions
encountered while encoding can be held within this subclass
of MultiException.ProviderEncoder.encodeBlocking(Object)
public Provider getProvider()
ProviderObject
getProvider
in interface ProviderObject
ProviderObject.getProvider()
public void encode(Object obj) throws EncoderException
encode
in interface StatefulEncoder
obj
- the message object to encode into a PDUEncoderException
- if there are problems while encodingpublic void setCallback(EncoderCallback cb)
setCallback
in interface StatefulEncoder
cb
- the callback to set on the underlying provider specific encoderpublic void setEncoderMonitor(EncoderMonitor monitor)
setEncoderMonitor
in interface StatefulEncoder
monitor
- the monitor to set on the underlying implementationCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.