文件转写
来源:互联网 发布:python取小数点后两位 编辑:程序博客网 时间:2024/04/29 15:25
import java.io.*; public class SrtTemplate { public static void main(String[] args) { File file=new File("D:/Downloads/videoes/srt/old.txt"); //源字幕文件位置 File file2=new File("D:/Downloads/videoes/srt/template.txt"); //新的字幕文件保存位置 int timeError=3; //在此设定需要调整的时间秒数,正数为延迟,负数为提早 int id=1; FileWriter fw=null; try { file2.createNewFile(); //创建新文件 fw = new FileWriter(file2); //创建文件输出流 } catch (IOException ex) { ex.printStackTrace(); } PrintWriter pw=new PrintWriter(fw); //包装文件输出流,方便整行写入 try { FileReader fr=new FileReader(file); //创建文件输入流 BufferedReader in=new BufferedReader(fr); //包装文件输入流,方便整行读取 String line; StringBuffer newLine=new StringBuffer(); //以下while循环逐行读取字幕源文件 while((line=in.readLine()) != null) { //使用静态方法进行正则式的匹配。 pw.println(id++);pw.println("00:00:00,000 --> 00:00:00,000");pw.println(line);pw.println();//如果读到的不是时间描述字符行,则原样写入新文件 //提早结束本次循环继续读取下一行 //以下对时间描述字符行进行格式转换和数学运算 } pw.close(); } catch (FileNotFoundException ex) { ex.printStackTrace(); }catch (IOException ex) { ex.printStackTrace(); } } }
0 0
- 文件转写
- 转写东西
- android把日志内容转写到手机的某个目录的文件里
- 转写QTP学习资料
- DOM4J解析XML转写TXT
- ftp安装配置运行(转写)
- imdict-chinese-analyzer .NET转写版
- 讯飞语音识别和转写代码
- 转写C++程序要清楚自己的角色
- 深度全序列卷积神经网络成功用于语音转写技术
- python调用讯飞付费版语音转写
- 数据结构 线性表部分代码 C语言转写(待补充)
- 数据结构 单链部分代码 C语言转写(待补充)
- 从任务到可视化,如何理解LSTM网络中的神经元 By 机器之心2017年7月03日 14:29 对人类而言,转写是一件相对容易并且可解释的任务,所以它比较适合用来解释神经网络做了哪些事情,以及神经网
- 文件
- 文件
- 文件
- 文件
- Automation investigation tech
- Pydoc 本地 HTML 形式查看
- Redis 高可用: 主从复制
- 下载和安装 Visual Studio 2015 软件 的详细步骤图文教程
- 我面试到底问什么?
- 文件转写
- how to quit webview player
- 从0开始学习 GitHub 系列之「向GitHub 提交代码」
- 彻底解决Fragment重叠的问题
- OpenCV 3 - 编译更强大的OpenCV(二) - 拼人品时刻
- Python3 pip 解决问题: error: Unable to find vcvarsall.bat
- 第十三章 编程练习
- My-学编程之路
- C# winform 无边框窗体鼠标点击移动事件