org.apache.ignite.internal.client.thin.io.gridnioserver

## Class GridNioClientParser

- java.lang.Object
- - org.apache.ignite.internal.client.thin.io.gridnioserver.GridNioClientParser

All Implemented Interfaces:
  GridNioParser

    public class GridNioClientParser
    extends Object
    implements GridNioParser

Client message parser.

### Constructor Summary

Constructors
Constructor and Description
`GridNioClientParser()`

### Method Summary

All Methods Instance Methods Concrete Methods
`@Nullable Object` `decode(GridNioSession ses, ByteBuffer buf)` This method is called when input bytes are available on the underlying network connection.
`ByteBuffer` `encode(GridNioSession ses, Object msg)` This method is called whenever a message should be sent to the network connection and network buffer is ready to be filled with bytes.

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

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

### Constructor Detail

#### GridNioClientParser

    public GridNioClientParser()

### Method Detail

#### decode

    @Nullable
    public @Nullable Object decode(GridNioSession ses,
                                             ByteBuffer buf)

This method is called when input bytes are available on the underlying network connection.

Method must read given buffer until either it reaches the end of buffer or a valid user message is encountered. In this case it must return parsed message.

Specified by:
  `decode` in interface `GridNioParser`
Parameters:
  `ses` - Session on which bytes are read.
  `buf` - Buffer that contains input data.
Returns:
  Parsed user message or `null` if complete message has not been received yet. Note that in case of returning `null` given buffer must be completely read.

#### encode

    public ByteBuffer encode(GridNioSession ses,
                             Object msg)

This method is called whenever a message should be sent to the network connection and network buffer is ready to be filled with bytes.

Method must encode the complete message and return byte buffer from which data should be read.

Specified by:
  `encode` in interface `GridNioParser`
Parameters:
  `ses` - Session on which message is being sent.
  `msg` - Message to encode.
Returns:
  Buffer containing encoded message.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023