From 7d387aa126262ee12068f5b31aad661501edd286 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 13 十一月 2024 16:34:21 +0800
Subject: [PATCH] 优化未关阀记录接口
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 1 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
index 2f0c7d6..a42953c 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -4,7 +4,50 @@
public class ByteUtil {
-
+
+ /**
+ * 灏嗗瓧鑺傛暟缁勫垎鍓�
+ * @param bytes 琚垎鍓叉暟缁�
+ * @param fromIndex 鍒嗗壊璧峰浣嶇疆
+ * @param len 鍒嗗壊闀垮害
+ * @return 杩斿洖 鍒嗗壊鍑烘潵鐨勬暟缁�
+ */
+ public static byte[] bytesSplit(byte[] bytes, int fromIndex, int len){
+ if(bytes == null){
+ return null ;
+ }else{
+ byte[] bs = new byte[len] ;
+ if(fromIndex + len > bytes.length){
+ System.arraycopy(bytes, fromIndex, bs, 0, bytes.length - fromIndex) ;
+ }else{
+ System.arraycopy(bytes, fromIndex, bs, 0, len) ;
+ }
+ return bs ;
+ }
+ }
+ /**
+ * 灏嗗瓧鑺傛暟缁勫垎鍓�
+ * @param bytes 琚垎鍓叉暟缁�
+ * @param fromIndex 鍒嗗壊璧峰浣嶇疆
+ * @param len 鍒嗗壊闀垮害
+ * @return 杩斿洖 鍒嗗壊鍑烘潵鐨勬暟缁�
+ */
+ public static Object[] bytesSplit_(byte[] bytes, int fromIndex, int len){
+ if(bytes == null){
+ return null ;
+ }else{
+ int realLen = len ;
+ byte[] bs = new byte[len] ;
+ if(fromIndex + len > bytes.length){
+ System.arraycopy(bytes, fromIndex, bs, 0, bytes.length - fromIndex) ;
+ realLen = bytes.length - fromIndex ;
+ }else{
+ System.arraycopy(bytes, fromIndex, bs, 0, len) ;
+ }
+ return new Object[]{bs, realLen} ;
+ }
+ }
+
/**
* 灏嗗瓧鑺傛暟缁勫悎骞跺埌瀛楄妭鏁扮粍涓�
* @param bGroup1 琚悎骞舵暟缁�
--
Gitblit v1.8.0