|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.comm.codec.Decoder<ByteBuffer,ByteBuffer>
com.kuka.comm.codec.bytebuffer.EnclosingTokenDecoder
public final class EnclosingTokenDecoder
This decoder delimits a payload strictly with a constant prefix and postfix. Hence, it must be given that prefix and postfix are not part of the payload code. Non-prefix bytes in front of the prefix are skipped.
| Constructor Summary | |
|---|---|
EnclosingTokenDecoder(byte[] prefix,
byte[] postfix)
Creates a new enclosing token decoder. |
|
EnclosingTokenDecoder(String prefix,
String postfix)
Creates a new enclosing token decoder. |
|
| Method Summary | |
|---|---|
protected ByteBuffer |
decodeImpl(ByteBuffer in)
Realization of the decoding method to be implemented in subclasses. |
boolean |
isPostfixIncluded()
Returns true if the postfix should be included. |
boolean |
isPrefixIncluded()
Returns true if the prefix should be included. |
EnclosingTokenDecoder |
setPostfixIncluded(boolean postfixIncluded)
If set to true the postfix is included in the decoded message. |
EnclosingTokenDecoder |
setPrefixIncluded(boolean prefixIncluded)
If set to true the prefix is included in the decoded message. |
| 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 EnclosingTokenDecoder(String prefix,
String postfix)
Splits the input into data frames, each starting with a prefix (header) and ending with a postfix (footer). The data frame will then be passed to the concatenated decoder.
By default the prefix and postfix are not included. Use setPrefixIncluded(boolean) and
setPostfixIncluded(boolean) to change that.
prefix - The prefix. It may not be null or empty. The prefix must be different from the postfix and it may not
contain the postfix as a substring.postfix - The postfix. It may not be null or empty. The postfix must be different from the prefix and it may not
contain the prefix as a substring.
public EnclosingTokenDecoder(byte[] prefix,
byte[] postfix)
Splits the input into data frames, each starting with a prefix (header) and ending with a postfix (footer). The data frame will then be passed to the concatenated decoder.
By default the prefix and postfix are not included. Use setPrefixIncluded(boolean) and
setPostfixIncluded(boolean) to change that.
prefix - The prefix. It may not be null or empty. The prefix must be different from the postfix and it may not
contain the postfix as a substring.postfix - The postfix. It may not be null or empty. The postfix must be different from the prefix and it may not
contain the prefix as a substring.| Method Detail |
|---|
public EnclosingTokenDecoder setPrefixIncluded(boolean prefixIncluded)
true the prefix is included in the decoded message.
prefixIncluded - if set to true the prefix is included in the decoded message
setPostfixIncluded(boolean)public boolean isPrefixIncluded()
true if the prefix should be included.
true if the prefix should be includedisPostfixIncluded()public EnclosingTokenDecoder setPostfixIncluded(boolean postfixIncluded)
true the postfix is included in the decoded message.
postfixIncluded - if set to true the postfix is included in the decoded message
setPrefixIncluded(boolean)public boolean isPostfixIncluded()
true if the postfix should be included.
true if the postfix should be includedisPrefixIncluded()
protected ByteBuffer decodeImpl(ByteBuffer 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<ByteBuffer,ByteBuffer>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 | |||||||||