com.kuka.comm.codec.bytebuffer
Class ByteOrderDecoder

java.lang.Object
  extended by com.kuka.comm.codec.Decoder<ByteBuffer,ByteBuffer>
      extended by com.kuka.comm.codec.bytebuffer.ByteOrderDecoder

public final class ByteOrderDecoder
extends Decoder<ByteBuffer,ByteBuffer>

A Decoder to modify the byte order of a ByteBuffer. The position and limit of the passed byte buffer will not be changed.


Constructor Summary
ByteOrderDecoder(ByteOrder byteOrder)
          Creates a new decoder, that modifies the byte order of the given byte buffer.
 
Method Summary
protected  ByteBuffer decodeImpl(ByteBuffer 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

ByteOrderDecoder

public ByteOrderDecoder(ByteOrder byteOrder)
Creates a new decoder, that modifies the byte order of the given byte buffer.

Parameters:
byteOrder - the preferred byte order, either ByteOrder.BIG_ENDIAN or ByteOrder.LITTLE_ENDIAN
Method Detail

decodeImpl

protected ByteBuffer decodeImpl(ByteBuffer in)
Description copied from class: Decoder
Realization of the decoding method to be implemented in subclasses. This method will be called by the Decoder.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.

Specified by:
decodeImpl in class Decoder<ByteBuffer,ByteBuffer>
Parameters:
in - the input for this decoder, usually the message to be decoded
Returns:
the decoded message, or null if the input was incomplete


Copyright © 2019. All rights reserved.