com.kuka.comm.codec.bytebuffer
Class LengthEncoder<I>

java.lang.Object
  extended by com.kuka.comm.codec.Encoder<I,ByteBuffer>
      extended by com.kuka.comm.codec.bytebuffer.LengthEncoder<I>
Type Parameters:
I - the input type of this encoder

public final class LengthEncoder<I>
extends Encoder<I,ByteBuffer>

Encoder that writes the length of a given variable length payload that is encoded by the next concatenated encoder.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.kuka.comm.codec.Encoder
Encoder.EncoderContext
 
Constructor Summary
LengthEncoder(LengthFieldType type)
          Creates a new encoder that writes the length of a given variable length payload.
 
Method Summary
protected  void encodeImpl(I in, ByteBuffer out, Encoder.EncoderContext context)
          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

LengthEncoder

public LengthEncoder(LengthFieldType type)
Creates a new encoder that writes the length of a given variable length payload.

Parameters:
type - the type of the length field, must not be null
Throws:
IllegalArgumentException - if the type is null
Method Detail

encodeImpl

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

The context is currently only taken into account if this encoder is concatenated to another one Encoder.concat(Encoder).

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

Overrides:
encodeImpl in class Encoder<I,ByteBuffer>
Parameters:
in - the input for this encoder
out - the output for this encoder
context - can be used to do some more encoding after a concatenated encoder finished
See Also:
Encoder.encodeImpl(Object, Object)


Copyright © 2019. All rights reserved.