----添加流程测试demo

This commit is contained in:
2025-12-02 10:21:46 +08:00
parent db1dd23743
commit a5b65b4f38
46 changed files with 2611 additions and 11 deletions

View File

@ -1,5 +1,10 @@
package com.xjrsoft;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -7,6 +12,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.xjrsoft.module.common.db.service.CommonCallService;
import cn.hutool.core.io.IoUtil;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ITCDemoApplication.class)
public class CallTest {
@ -21,5 +28,21 @@ public class CallTest {
String out = callService.saveAfter("Ing_b_price_term", 12);
System.out.println(out);
}
public static void main(String[] args) {
String filePath = "D:\\java\\conf\\cn-ips.txt";
boolean first = false;
// 2. 流式读取(适合大文件,逐行处理,不占内存)
try (Stream<String> lineStream = Files.lines(Paths.get(filePath))) {
lineStream.forEach(line -> {
// 逐行处理逻辑(如解析、过滤)
if (!line.isEmpty()) { // 跳过空行
System.out.print(";" + line);
}
});
} catch (IOException e) {
System.err.println("流式读取失败:" + e.getMessage());
}
}
}