From 4f99f59668c9160ca60958b7347944def26f2228 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 27 四月 2025 10:58:53 +0800 Subject: [PATCH] 回退配置 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/PrefixedDataAvailableStatus.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/PrefixedDataAvailableStatus.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/PrefixedDataAvailableStatus.java new file mode 100644 index 0000000..3fe03b0 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/PrefixedDataAvailableStatus.java @@ -0,0 +1,111 @@ +package com.dy.common.mw.channel.tcp; + +public class PrefixedDataAvailableStatus { + + public final static Integer status_rubbish = 0 ;//鍨冨溇鏁版嵁 + public final static Integer status_break = 1 ;//鏂寘 + public final static Integer status_adjoin = 2 ;//绮樺寘 + public final static Integer status_complete = 3 ;//涓嶆柇涓嶇矘 + + private Integer status ; + private Integer dataLen ; + public String protocolName; + public Short protocolVersion; + + public PrefixedDataAvailableStatus(){ + status = null ; + dataLen = null ; + } + + /** + * 鍨冨溇鏁版嵁 + * @param dataLen 鏁版嵁闀垮害 + * @return 鐘舵�� + */ + @SuppressWarnings("unused") + public PrefixedDataAvailableStatus rubbish(Integer dataLen){ + this.status = status_rubbish ; + this.dataLen = dataLen ; + return this ; + } + + /** + * 鍙戠敓鏂寘 + * @return 鐘舵�� + */ + @SuppressWarnings("unused") + public PrefixedDataAvailableStatus breaked(){ + this.status = status_break ; + this.dataLen = null ; + return this ; + } + + /** + * 鍙戠敓绮樺寘 + * @param dataLen 鏁版嵁闀垮害 + * @return 鐘舵�� + */ + @SuppressWarnings("unused") + public PrefixedDataAvailableStatus adjoined(Integer dataLen, String protocolName, Short protocolVersion){ + this.status = status_adjoin ; + this.dataLen = dataLen ; + this.protocolName = protocolName ; + this.protocolVersion = protocolVersion ; + return this ; + } + + /** + * 涓嶆柇鍖呬笉绮樺寘锛屾暟鎹濂芥敹鍏� + * @param dataLen 鏁版嵁闀垮害 + * @return 鐘舵�� + */ + @SuppressWarnings("unused") + public PrefixedDataAvailableStatus completed(Integer dataLen, String protocolName, Short protocolVersion){ + this.status = status_complete ; + this.dataLen = dataLen ; + this.protocolName = protocolName ; + this.protocolVersion = protocolVersion ; + return this ; + } + + /** + * 鏄惁鍨冨溇鏁版嵁 + * @return 鐘舵�� + */ + public boolean isRubbish(){ + return this.status.intValue() == status_rubbish.intValue(); + } + /** + * 鏄惁鏂寘 + * @return 鐘舵�� + */ + public boolean isBreaked(){ + return this.status.intValue() == status_break.intValue(); + } + + + /** + * 鏄惁绮樺寘 + * @return 鏄惁绮樺寘 + */ + public boolean isAdjoined(){ + return this.status.intValue() == status_adjoin.intValue(); + } + + /** + * 鏄惁涓嶆柇涓嶇矘 + * @return 鏄惁涓嶆柇涓嶇矘 + */ + public boolean isCompleted(){ + return this.status.intValue() == status_complete.intValue(); + } + + /** + * 杩斿洖鏁版嵁闀垮害 + * @return 鏁版嵁闀垮害 + */ + public Integer getDataLen(){ + return this.dataLen ; + } + +} -- Gitblit v1.8.0