|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.comm.codec.Decoder<M,O>
com.kuka.comm.codec.SwitchDecoder<M,S,I,O>
M - the initial input type for the switch info decoderS - the type of the SwitchInfo tokenI - the input type of the actual decoderO - the output type of the actual decoderpublic final class SwitchDecoder<M,S,I,O>
A SwitchDecoder selects a Decoder decoder to decode the input based on the content of the input.
It is provided with a single switch info Decoder to decode the SwitchInfo of a given input.
Based on the decoded SwitchInfo the actual decoder will be selected among the decoders provided by the
user and it will be used to decode the input given in the said SwitchInfo.
| Constructor Summary | |
|---|---|
SwitchDecoder(Decoder<M,SwitchInfo<S,I>> switchInfoDecoder)
Creates a new DecoderSwitch that uses the given Decoder to decode the SwitchInfo of
a given input. |
|
| Method Summary | |
|---|---|
SwitchDecoder<M,S,I,O> |
addDecoder(S switchToken,
Decoder<I,O> decoder)
Adds a Decoder to this DecoderSwitch and associates it with the given token. |
protected O |
decodeImpl(M in)
Realization of the decoding method to be implemented in subclasses. |
| Methods inherited from class com.kuka.comm.codec.Decoder |
|---|
concat, decode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SwitchDecoder(Decoder<M,SwitchInfo<S,I>> switchInfoDecoder)
DecoderSwitch that uses the given Decoder to decode the SwitchInfo of
a given input. Based on the decoded SwitchInfo the actual decoder will be selected and it will be
used to decode the input given in the said SwitchInfo.
switchInfoDecoder - The decoder to decode the SwitchInfo.| Method Detail |
|---|
public SwitchDecoder<M,S,I,O> addDecoder(S switchToken,
Decoder<I,O> decoder)
Decoder to this DecoderSwitch and associates it with the given token. This decoder
will be selected whenever the decoded SwitchInfo contains the given token. A switch token can only be
associated with one decoder. If the given token is already known, the this decoder will replace the previously
set decoder.
switchToken - the switch tokendecoder - the decoder
protected O decodeImpl(M in)
throws DecoderException
DecoderDecoder.decode(Object) method.
Return null to indicate that the decoder could not finish its job (e.g. because the input was
incomplete). The decoding will be cancelled, i.e. concatenated decoders coming after this decoder will not be
called, and the decoding process will restart, when more data is available. Throw an exception to indicate that
an error occurred during decoding. The data read so far will be discarded.
decodeImpl in class Decoder<M,O>in - the input for this decoder, usually the message to be decoded
null if the input was incomplete
DecoderException - if an error occurred during decoding
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||