重构:统一核心和消息中心的雪花 ID
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.xiaowang.messagehub.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.xiaowang.messagehub.support.id.TimeOrderedSnowflakeIdGenerator;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -43,4 +45,19 @@ public class MyBatisPlusConfig {
|
||||
|
||||
return interceptor; // 返回配置好的拦截器
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IdentifierGenerator identifierGenerator(TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator) {
|
||||
return new IdentifierGenerator() {
|
||||
@Override
|
||||
public Number nextId(Object entity) {
|
||||
return snowflakeIdGenerator.nextId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String nextUUID(Object entity) {
|
||||
return snowflakeIdGenerator.nextIdString();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
@TableName("message_channel_config")
|
||||
public class MessageChannelConfigDO {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
@TableField("channel_type")
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
|
||||
@TableName("message") // MyBatis-Plus的表名注解,指定对应数据库表名为message
|
||||
public class MessageDO {
|
||||
// 主键ID,使用自增策略
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
// 消息内容字段
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.time.LocalDateTime;
|
||||
@TableName("message_source_system_channel")
|
||||
public class MessageSourceSystemChannelDO {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
@TableField("system_id")
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.time.LocalDateTime;
|
||||
@TableName("message_source_system")
|
||||
public class MessageSourceSystemDO {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
@TableField("system_code")
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
|
||||
@TableName("push_template")
|
||||
public class PushTemplateDO {
|
||||
// 主键ID,自增长类型
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
// 模板代码,用于唯一标识一个模板
|
||||
|
||||
+43
-60
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xiaowang.messagehub.config.RabbitMQConfig;
|
||||
import com.xiaowang.messagehub.dto.MessageDTO;
|
||||
import com.xiaowang.messagehub.dto.SmsMessageDTO;
|
||||
import com.xiaowang.messagehub.support.id.TimeOrderedSnowflakeIdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageBuilder;
|
||||
@@ -13,72 +14,62 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 消息生产者服务类
|
||||
* 使用RabbitMQ发送短信和邮件消息
|
||||
* 使用 RabbitMQ 发送短信、邮件、微信和推送消息。
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MessageProducerService {
|
||||
|
||||
// RabbitMQ模板,用于发送消息
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
// 对象映射器,用于将对象转换为JSON字符串
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
private TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
|
||||
|
||||
/**
|
||||
* 发送短信消息
|
||||
* @param messageDTO 消息数据传输对象,包含短信相关信息
|
||||
* 发送短信消息。
|
||||
*/
|
||||
public void sendSmsMessage(SmsMessageDTO messageDTO) {
|
||||
try {
|
||||
// 生成唯一消息ID
|
||||
String messageId = UUID.randomUUID().toString();
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
ensureUniqueId(messageDTO, messageId);
|
||||
|
||||
// 将消息对象转换为JSON字符串
|
||||
|
||||
String messageBody = objectMapper.writeValueAsString(messageDTO);
|
||||
|
||||
// 构建RabbitMQ消息对象
|
||||
Message message = MessageBuilder
|
||||
.withBody(messageBody.getBytes())
|
||||
.setContentType(MessageProperties.CONTENT_TYPE_JSON)
|
||||
.setMessageId(messageId)
|
||||
.setTimestamp(new java.util.Date())
|
||||
.build();
|
||||
|
||||
// 发送消息到短信队列
|
||||
|
||||
rabbitTemplate.send(
|
||||
RabbitMQConfig.MESSAGE_EXCHANGE,
|
||||
"sms." + messageDTO.getMsgType().toLowerCase(),
|
||||
message
|
||||
);
|
||||
|
||||
// 记录消息发送日志
|
||||
log.info("短信消息已发送到队列,消息ID: {}, 手机号: {}, 消息类型: {}", messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception e) {
|
||||
// 记录错误日志并抛出运行时异常
|
||||
log.error("发送短信消息失败", e);
|
||||
throw new RuntimeException("发送短信消息失败: " + e.getMessage(), e);
|
||||
|
||||
log.info("短信消息已发送到队列,消息ID: {}, 手机号: {}, 消息类型: {}",
|
||||
messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception exception) {
|
||||
log.error("发送短信消息失败", exception);
|
||||
throw new RuntimeException("发送短信消息失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件消息
|
||||
* @param messageDTO 消息数据传输对象,包含邮件相关信息
|
||||
* 发送邮件消息。
|
||||
*/
|
||||
public void sendEmailMessage(MessageDTO messageDTO) {
|
||||
try {
|
||||
String messageId = UUID.randomUUID().toString();
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
ensureUniqueId(messageDTO, messageId);
|
||||
|
||||
String messageBody = objectMapper.writeValueAsString(messageDTO);
|
||||
|
||||
Message message = MessageBuilder
|
||||
.withBody(messageBody.getBytes())
|
||||
.setContentType(MessageProperties.CONTENT_TYPE_JSON)
|
||||
@@ -92,24 +83,23 @@ public class MessageProducerService {
|
||||
message
|
||||
);
|
||||
|
||||
log.info("邮件消息已发送到队列,消息ID: {}, 收件人: {}, 消息类型: {}", messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception e) {
|
||||
log.error("发送邮件消息失败", e);
|
||||
throw new RuntimeException("发送邮件消息失败: " + e.getMessage(), e);
|
||||
log.info("邮件消息已发送到队列,消息ID: {}, 收件人: {}, 消息类型: {}",
|
||||
messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception exception) {
|
||||
log.error("发送邮件消息失败", exception);
|
||||
throw new RuntimeException("发送邮件消息失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送微信消息
|
||||
* @param messageDTO 消息数据传输对象,包含微信相关信息
|
||||
* 发送微信消息。
|
||||
*/
|
||||
public void sendWeChatMessage(MessageDTO messageDTO) {
|
||||
try {
|
||||
String messageId = UUID.randomUUID().toString();
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
ensureUniqueId(messageDTO, messageId);
|
||||
|
||||
String messageBody = objectMapper.writeValueAsString(messageDTO);
|
||||
|
||||
Message message = MessageBuilder
|
||||
.withBody(messageBody.getBytes())
|
||||
.setContentType(MessageProperties.CONTENT_TYPE_JSON)
|
||||
@@ -123,24 +113,23 @@ public class MessageProducerService {
|
||||
message
|
||||
);
|
||||
|
||||
log.info("微信消息已发送到队列,消息ID: {}, 接收者: {}, 消息类型: {}", messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception e) {
|
||||
log.error("发送微信消息失败", e);
|
||||
throw new RuntimeException("发送微信消息失败: " + e.getMessage(), e);
|
||||
log.info("微信消息已发送到队列,消息ID: {}, 接收者: {}, 消息类型: {}",
|
||||
messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception exception) {
|
||||
log.error("发送微信消息失败", exception);
|
||||
throw new RuntimeException("发送微信消息失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送推送消息
|
||||
* @param messageDTO 消息数据传输对象,包含推送相关信息
|
||||
* 发送推送消息。
|
||||
*/
|
||||
public void sendPushMessage(MessageDTO messageDTO) {
|
||||
try {
|
||||
String messageId = UUID.randomUUID().toString();
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
ensureUniqueId(messageDTO, messageId);
|
||||
|
||||
String messageBody = objectMapper.writeValueAsString(messageDTO);
|
||||
|
||||
Message message = MessageBuilder
|
||||
.withBody(messageBody.getBytes())
|
||||
.setContentType(MessageProperties.CONTENT_TYPE_JSON)
|
||||
@@ -154,25 +143,23 @@ public class MessageProducerService {
|
||||
message
|
||||
);
|
||||
|
||||
log.info("推送消息已发送到队列,消息ID: {}, 接收者: {}, 消息类型: {}", messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception e) {
|
||||
log.error("发送推送消息失败", e);
|
||||
throw new RuntimeException("发送推送消息失败: " + e.getMessage(), e);
|
||||
log.info("推送消息已发送到队列,消息ID: {}, 接收者: {}, 消息类型: {}",
|
||||
messageId, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception exception) {
|
||||
log.error("发送推送消息失败", exception);
|
||||
throw new RuntimeException("发送推送消息失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用发送消息方法
|
||||
* 根据渠道类型自动路由到对应的队列
|
||||
* @param messageDTO 消息数据传输对象
|
||||
* 通用发送消息方法。
|
||||
*/
|
||||
public void sendMessage(MessageDTO messageDTO) {
|
||||
try {
|
||||
String messageId = UUID.randomUUID().toString();
|
||||
String messageId = snowflakeIdGenerator.nextIdString();
|
||||
ensureUniqueId(messageDTO, messageId);
|
||||
|
||||
String messageBody = objectMapper.writeValueAsString(messageDTO);
|
||||
|
||||
Message message = MessageBuilder
|
||||
.withBody(messageBody.getBytes())
|
||||
.setContentType(MessageProperties.CONTENT_TYPE_JSON)
|
||||
@@ -195,17 +182,13 @@ public class MessageProducerService {
|
||||
routingKey = "unknown." + messageDTO.getMsgType().toLowerCase();
|
||||
}
|
||||
|
||||
rabbitTemplate.send(
|
||||
RabbitMQConfig.MESSAGE_EXCHANGE,
|
||||
routingKey,
|
||||
message
|
||||
);
|
||||
rabbitTemplate.send(RabbitMQConfig.MESSAGE_EXCHANGE, routingKey, message);
|
||||
|
||||
log.info("消息已发送到队列,消息ID: {}, 渠道类型: {}, 接收者: {}, 消息类型: {}",
|
||||
log.info("消息已发送到队列,消息ID: {}, 渠道类型: {}, 接收者: {}, 消息类型: {}",
|
||||
messageId, channelType, messageDTO.getReceiver(), messageDTO.getMsgType());
|
||||
} catch (Exception e) {
|
||||
log.error("发送消息失败", e);
|
||||
throw new RuntimeException("发送消息失败: " + e.getMessage(), e);
|
||||
} catch (Exception exception) {
|
||||
log.error("发送消息失败", exception);
|
||||
throw new RuntimeException("发送消息失败: " + exception.getMessage(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -6,6 +6,7 @@ import com.xiaowang.messagehub.model.ManagedChannelConfig;
|
||||
import com.xiaowang.messagehub.model.SmsDispatchRequest;
|
||||
import com.xiaowang.messagehub.model.SmsSendResult;
|
||||
import com.xiaowang.messagehub.service.channel.ChannelEnvironmentService;
|
||||
import com.xiaowang.messagehub.support.id.TimeOrderedSnowflakeIdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -14,9 +15,12 @@ import org.springframework.stereotype.Service;
|
||||
public class MockSmsChannelProvider implements SmsChannelProvider {
|
||||
|
||||
private final ChannelEnvironmentService environmentService;
|
||||
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
|
||||
|
||||
public MockSmsChannelProvider(ChannelEnvironmentService environmentService) {
|
||||
public MockSmsChannelProvider(ChannelEnvironmentService environmentService,
|
||||
TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator) {
|
||||
this.environmentService = environmentService;
|
||||
this.snowflakeIdGenerator = snowflakeIdGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +46,7 @@ public class MockSmsChannelProvider implements SmsChannelProvider {
|
||||
|
||||
SmsSendResult result = new SmsSendResult();
|
||||
result.setMessage("Mock 短信发送成功");
|
||||
result.setRequestId("MOCK-" + System.currentTimeMillis());
|
||||
result.setRequestId("MOCK-" + snowflakeIdGenerator.nextIdString());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
package com.xiaowang.messagehub.support.id;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 时间高位雪花 ID 生成器。
|
||||
* 用于消息中心主键、消息标识和有序业务编码生成。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TimeOrderedSnowflakeIdGenerator {
|
||||
|
||||
private static final long DEFAULT_EPOCH = 1704067200000L;
|
||||
private static final long WORKER_ID_BITS = 5L;
|
||||
private static final long DATACENTER_ID_BITS = 5L;
|
||||
private static final long SEQUENCE_BITS = 12L;
|
||||
private static final long MAX_WORKER_ID = ~(-1L << WORKER_ID_BITS);
|
||||
private static final long MAX_DATACENTER_ID = ~(-1L << DATACENTER_ID_BITS);
|
||||
private static final long SEQUENCE_MASK = ~(-1L << SEQUENCE_BITS);
|
||||
private static final long WORKER_ID_SHIFT = SEQUENCE_BITS;
|
||||
private static final long DATACENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS;
|
||||
private static final long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATACENTER_ID_BITS;
|
||||
|
||||
private final long epoch;
|
||||
private final long workerId;
|
||||
private final long datacenterId;
|
||||
|
||||
private long sequence = 0L;
|
||||
private long lastTimestamp = -1L;
|
||||
|
||||
public TimeOrderedSnowflakeIdGenerator(
|
||||
@Value("${snowflake.epoch:" + DEFAULT_EPOCH + "}") long configuredEpoch,
|
||||
@Value("${snowflake.worker-id:-1}") long configuredWorkerId,
|
||||
@Value("${snowflake.datacenter-id:-1}") long configuredDatacenterId,
|
||||
@Value("${spring.application.name:message-hub}") String applicationName
|
||||
) {
|
||||
this.epoch = configuredEpoch > 0 ? configuredEpoch : DEFAULT_EPOCH;
|
||||
this.datacenterId = resolveNodeId(configuredDatacenterId, MAX_DATACENTER_ID, resolveDatacenterId());
|
||||
this.workerId = resolveNodeId(configuredWorkerId, MAX_WORKER_ID, resolveWorkerId(applicationName));
|
||||
log.info("Snowflake generator ready: app={}, epoch={}, datacenterId={}, workerId={}",
|
||||
applicationName, this.epoch, this.datacenterId, this.workerId);
|
||||
}
|
||||
|
||||
public synchronized long nextId() {
|
||||
long timestamp = currentTimeMillis();
|
||||
if (timestamp < lastTimestamp) {
|
||||
timestamp = waitUntil(lastTimestamp);
|
||||
}
|
||||
|
||||
if (timestamp == lastTimestamp) {
|
||||
sequence = (sequence + 1) & SEQUENCE_MASK;
|
||||
if (sequence == 0L) {
|
||||
timestamp = waitUntilNextMillis(lastTimestamp);
|
||||
}
|
||||
} else {
|
||||
sequence = 0L;
|
||||
}
|
||||
|
||||
lastTimestamp = timestamp;
|
||||
return ((timestamp - epoch) << TIMESTAMP_LEFT_SHIFT)
|
||||
| (datacenterId << DATACENTER_ID_SHIFT)
|
||||
| (workerId << WORKER_ID_SHIFT)
|
||||
| sequence;
|
||||
}
|
||||
|
||||
public String nextIdString() {
|
||||
return Long.toUnsignedString(nextId());
|
||||
}
|
||||
|
||||
public String nextBase36String(int width) {
|
||||
String raw = Long.toUnsignedString(nextId(), 36).toUpperCase(Locale.ROOT);
|
||||
if (raw.length() >= width) {
|
||||
return raw.substring(raw.length() - width);
|
||||
}
|
||||
return "0".repeat(width - raw.length()) + raw;
|
||||
}
|
||||
|
||||
private long currentTimeMillis() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private long waitUntil(long targetTimestamp) {
|
||||
long timestamp = currentTimeMillis();
|
||||
while (timestamp < targetTimestamp) {
|
||||
Thread.yield();
|
||||
timestamp = currentTimeMillis();
|
||||
}
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
private long waitUntilNextMillis(long currentTimestamp) {
|
||||
long timestamp = currentTimeMillis();
|
||||
while (timestamp <= currentTimestamp) {
|
||||
Thread.yield();
|
||||
timestamp = currentTimeMillis();
|
||||
}
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
private long resolveNodeId(long configuredValue, long maxValue, long fallbackValue) {
|
||||
long candidate = configuredValue >= 0 ? configuredValue : fallbackValue;
|
||||
return Math.floorMod(candidate, maxValue + 1);
|
||||
}
|
||||
|
||||
private long resolveDatacenterId() {
|
||||
return stableHash(resolveMachineFingerprint());
|
||||
}
|
||||
|
||||
private long resolveWorkerId(String applicationName) {
|
||||
return stableHash(applicationName + ":" + resolveProcessFingerprint());
|
||||
}
|
||||
|
||||
private String resolveMachineFingerprint() {
|
||||
try {
|
||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||
while (interfaces != null && interfaces.hasMoreElements()) {
|
||||
NetworkInterface networkInterface = interfaces.nextElement();
|
||||
if (networkInterface == null || networkInterface.isLoopback() || networkInterface.isVirtual()) {
|
||||
continue;
|
||||
}
|
||||
byte[] hardwareAddress = networkInterface.getHardwareAddress();
|
||||
if (hardwareAddress != null && hardwareAddress.length > 0) {
|
||||
return bytesToHex(hardwareAddress);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
log.warn("Unable to resolve hardware address for snowflake datacenter id", exception);
|
||||
}
|
||||
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (Exception exception) {
|
||||
log.warn("Unable to resolve host address for snowflake datacenter id", exception);
|
||||
return "fallback-host";
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveProcessFingerprint() {
|
||||
try {
|
||||
return ManagementFactory.getRuntimeMXBean().getName();
|
||||
} catch (Exception exception) {
|
||||
return "pid-unknown";
|
||||
}
|
||||
}
|
||||
|
||||
private long stableHash(String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return 0L;
|
||||
}
|
||||
long hash = 1469598103934665603L;
|
||||
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
|
||||
for (byte currentByte : bytes) {
|
||||
hash ^= currentByte;
|
||||
hash *= 1099511628211L;
|
||||
}
|
||||
return hash & Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
private String bytesToHex(byte[] source) {
|
||||
StringBuilder builder = new StringBuilder(source.length * 2);
|
||||
for (byte currentByte : source) {
|
||||
builder.append(String.format("%02X", currentByte));
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user