|  |  |  | 
|---|
|  |  |  | package com.dy.testClient.tcpClient; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.util.ByteUtil; | 
|---|
|  |  |  | import org.apache.logging.log4j.LogManager; | 
|---|
|  |  |  | import org.apache.logging.log4j.Logger; | 
|---|
|  |  |  | import org.apache.mina.core.buffer.IoBuffer; | 
|---|
|  |  |  | import org.apache.mina.core.session.IoSession; | 
|---|
|  |  |  | import org.apache.mina.filter.codec.CumulativeProtocolDecoder; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class LocalDecoder extends CumulativeProtocolDecoder { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final Logger log = LogManager.getLogger(LocalDecoder.class) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final String DECODER_STATE_KEY = LocalDecoder.class.getName() + ".STATE"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | byte[] preByte = new byte[remain]; | 
|---|
|  |  |  | in.get(preByte) ; | 
|---|
|  |  |  | in.position(0) ; | 
|---|
|  |  |  | log.info("收到中心下行数据:" + ByteUtil.bytes2Hex(preByte, true)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|