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

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security 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);
                }
            }
        }
    }
}