惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - _万古如长夜

WEB项目引入druid监控配置 java log4j 代码中 新增按日保存日志文件的功能 按钮居中固定 博文阅读密码验证 - 博客园 tomcat-设置jdk-设置标题-设置内存-配置项目路径 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 qrtz表初始化脚本_mysql 工具类 从jar包里复制要打生产的补丁(仅限T2) CPU使用过高问题/死锁 tomcat jvm 内存配置 文件下载-文件后缀 匹配content-type wsdl调用 不生成java文件方式 工具类-老版hibernate 占位符模式(?) in 的问题解决方案 nginx 设置超时 常用的正则表达式 DB2各种命令 mysql 各种命令
解析文件内容,匹配请求路径
_万古如长夜 · 2026-04-08 · via 博客园 - _万古如长夜
package com.bytter.ext.test;

import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class TestYidong {

    public static void main(String[] args) throws Exception{
        try {
            // 指定Excel文件路径
            String filePath = "C:\\Users\\zuiai\\Desktop\\example.xls";
            File file = new File(filePath);

            // 创建WorkbookSettings对象,可以设置编码等属性
            WorkbookSettings wbSettings = new WorkbookSettings();
            // 创建WritableWorkbook对象,用于写入数据
            WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings);
            workbook.createSheet("Sheet1", 0); // 创建工作表Sheet1
            WritableSheet sheet = workbook.getSheet(0); // 获取第一张工作表


            File folder = new File("E:\\software\\workspace\\ysjh_yunnan\\tdesignsign-dev");
            String keyword = "/api/audit/ysjh";
            File[] listOfFiles = folder.listFiles();
            int index = 0;
            // 写入数据到第一列和第二列,从第1行开始(Excel中第1行实际上是第0行)
            Label label1 = new Label(0, index, "文件路径"); // 第1列第1行(0-based index)
            Label label2 = new Label(1, index, "请求路径"); // 第2列第1行(0-based index)
            sheet.addCell(label1); // 添加到工作表
            sheet.addCell(label2); // 添加到工作表
            index++;

            outs(listOfFiles,keyword,sheet,index);

            // 写入完成后,关闭workbook以保存数据到文件
            workbook.write();
            workbook.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    private static void outs(File[] listOfFiles, String keyword, WritableSheet sheet, int index) throws Exception{

        if (listOfFiles != null) {
            for (File file : listOfFiles) {
                if (file.isFile()) { // 确保是文件
                    if(file.getName().endsWith(".js")){
                        System.out.println("File: " + file.getAbsolutePath());

                        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
                            String line;
                            while ((line = br.readLine()) != null) {
                                if (line.contains(keyword)) {
                                    // 写入数据到第一列和第二列,从第1行开始(Excel中第1行实际上是第0行)
                                    Label label1 = new Label(0, index, file.getAbsolutePath()); // 第1列第1行(0-based index)
                                    Label label2 = new Label(1, index, line); // 第2列第1行(0-based index)
                                    sheet.addCell(label1); // 添加到工作表
                                    sheet.addCell(label2); // 添加到工作表
                                    index++;
                                }
                            }
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }else{
                    outs(file.listFiles(),keyword,sheet,index);
                }
            }
        }
    }
}