ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

EV1文件转换FLV格式 Java实现

2022-06-19 00:34:11  阅读:335  来源: 互联网

标签:file Java String FLV br File new println EV1


EV1解密文件见附件。
请自行添加到环境变量中(win下面的ev1_decode.exe),如果你是linux或macos用户请自行编写java代码。
解密命令:ev1_decode 这里写文件路径

import sun.nio.cs.ext.GBK;

import java.io.*;
import java.nio.charset.Charset;

public class EV1Converter {
    static String path = "D:\\Download\\ARKDownLoad\\CCDownLoad";

    static String baseCommand="ev1_decode %s";
    public static void main(String[] args) {
        //要遍历的路径
        File file = new File(path);        //获取其file对象
        try {
            func(file);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    public static void func(File file) throws IOException {

        File[] fs = file.listFiles();
        for (File f : fs) {
            if (f.isDirectory())    //若是目录,则递归打印该目录下的文件
            {
                System.out.println("当前位于" + f.getAbsolutePath());
//                converter(f.getAbsolutePath());
            }
            if (f.isFile())        //若是文件,直接打印
                System.out.println("当前发现" + f);
            if(f.getName().matches(".+ev1")){
                System.out.println("发现一个EV1文件,执行命令...");
                System.out.println(f.getPath());
                converter(f.getPath());
            }
        }
    }
    public static void converter(String path) throws IOException {

        String newCommand=String.format(baseCommand,path);
        execCommand(newCommand);


    }
    public static void execCommand(String command) {
        BufferedReader br = null;
        try {
            File file = new File("daemonTmp");
            File tmpFile = new File("daemonTmp\\temp.tmp");//新建一个用来存储结果的缓存文件
            if (!file.exists()) {
                file.mkdirs();
            }
            if (!tmpFile.exists()) {
                tmpFile.createNewFile();
            }
            ProcessBuilder pb = new ProcessBuilder().command("cmd.exe", "/c", command).inheritIO();
            pb.redirectErrorStream(true);//这里是把控制台中的红字变成了黑字,用通常的方法其实获取不到,控制台的结果是pb.start()方法内部输出的。
            pb.redirectOutput(tmpFile);//把执行结果输出。
            pb.start().waitFor();//等待语句执行完成,否则可能会读不到结果。
            InputStream in = new FileInputStream(tmpFile);
            br = new BufferedReader(new InputStreamReader(in, Charset.forName("GBK")));
            String line = null;
            //好像可以用printWriter向cmd输出新玩意
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
            br.close();
            br = null;
            tmpFile.delete();//卸磨杀驴。
            System.out.println("执行完成");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

下载EV1解码工具

标签:file,Java,String,FLV,br,File,new,println,EV1
来源: https://www.cnblogs.com/6543x1/p/16389692.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有