com.kuka.comm.codec.bytebuffer
Class TokenEncoder

java.lang.Object
  extended by com.kuka.comm.codec.Encoder<Object,ByteBuffer>
      extended by com.kuka.comm.codec.bytebuffer.TokenEncoder

public final class TokenEncoder
extends Encoder<Object,ByteBuffer>

Encoder that writes a constant byte sequence.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.kuka.comm.codec.Encoder
Encoder.EncoderContext
 
Constructor Summary
TokenEncoder(byte[] token)
          Creates an encoder that writes the given byte subsequence (token).
TokenEncoder(String token)
          Creates an encoder that writes the given byte subsequence (token).
TokenEncoder(String token, Charset charset)
          Creates an encoder that writes the given byte subsequence (token).
 
Method Summary
protected  void encodeImpl(Object in, ByteBuffer out)
          Override this method to implement encoding process.
 
Methods inherited from class com.kuka.comm.codec.Encoder
concat, encode, encodeImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenEncoder

public TokenEncoder(String token)
Creates an encoder that writes the given byte subsequence (token). As charset the default charset of this Java virtual machine will be used (see Charset.defaultCharset().

Parameters:
token - the token to write

TokenEncoder

public TokenEncoder(String token,
                    Charset charset)
Creates an encoder that writes the given byte subsequence (token).

Parameters:
token - the token to write
charset - the charset of the string

TokenEncoder

public TokenEncoder(byte[] token)
Creates an encoder that writes the given byte subsequence (token).

Parameters:
token - the token to write
Method Detail

encodeImpl

protected void encodeImpl(Object in,
                          ByteBuffer out)
Description copied from class: Encoder
Override this method to implement encoding process.

Note: You should override either this method or Encoder.encodeImpl(Object, Object, EncoderContext). Overriding both will have no effect, i.e. only Encoder.encodeImpl(Object, Object, EncoderContext) will be called.

Overrides:
encodeImpl in class Encoder<Object,ByteBuffer>
Parameters:
in - the input for this encoder
out - the output for this encoder
See Also:
Encoder.encodeImpl(Object, Object, EncoderContext)


Copyright © 2019. All rights reserved.