|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.comm.codec.Decoder<I,O>
I - the input type of this decoderO - the output type of this decoderpublic abstract class Decoder<I,O>
Abstract realization of a decoder interface.
Decoders must be implemented in a thread-safe manner. They should either be stateless or their state should not be
changed while they are being used by a Connection or a Server.
| Constructor Summary | |
|---|---|
Decoder()
|
|
| Method Summary | ||
|---|---|---|
|
concat(Decoder<O,T> next)
This method concatenates two decoders, i.e. they will be executed in a row. |
|
O |
decode(I in)
Decodes the given input and returns the resulting object. |
|
protected abstract O |
decodeImpl(I in)
Realization of the decoding method to be implemented in subclasses. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Decoder()
| Method Detail |
|---|
public final O decode(I in)
throws DecoderException
This method is usually called in a connection (see Connection) to decode incoming messages. But it can
also be used by other decoders.
Returning null means 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. Throwing an exception means an error occurred during
decoding. The data read so far will be discarded.
in - the input for this decoder, usually the message to be decoded
null if the input was incomplete
DecoderException - if an error occurred during decodingpublic final <T> Decoder<I,T> concat(Decoder<O,T> next)
T - the output typenext - the decoder to be executed after this one
protected abstract O decodeImpl(I in)
throws DecoderException
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.
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 | |||||||||