org.apache.mina.coap.codec

## Class CoapDecoder

- java.lang.Object
- - org.apache.mina.coap.codec.CoapDecoder

All Implemented Interfaces:
  ProtocolDecoder<ByteBuffer,CoapMessage,Void>, StatelessProtocolDecoder<ByteBuffer,CoapMessage>

    public class CoapDecoder
    extends Object
    implements StatelessProtocolDecoder<ByteBuffer,CoapMessage>

Decoder CoAP messages from the ByteBuffer of a received UDP Datagram. Decode `ByteBuffer` into `CoapMessage`.

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`CoapDecoder()`

### Method Summary

Methods
`Void` `createDecoderState()` Create a new session context for this decoder
`CoapMessage` `decode(ByteBuffer input, Void context)` Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT
`void` `finishDecode(Void context)` Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CoapDecoder

    public CoapDecoder()

### Method Detail

#### createDecoderState

    public Void createDecoderState()

Create a new session context for this decoder

Specified by:
  `createDecoderState` in interface `ProtocolDecoder<ByteBuffer,CoapMessage,Void>`
Returns:
  the newly created context

#### decode

    public CoapMessage decode(ByteBuffer input,
                     Void context)

Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT

Specified by:
  `decode` in interface `ProtocolDecoder<ByteBuffer,CoapMessage,Void>`
Parameters:
  `input` - the received message to decode
  `context` - the decoding context (will be stored in the session for the next decode call)
Returns:
  the decoded message or `null` if nothing was decoded

#### finishDecode

    public void finishDecode(Void context)

Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

Specified by:
  `finishDecode` in interface `ProtocolDecoder<ByteBuffer,CoapMessage,Void>`