/*
 * Decompiled with CFR 0.152.
 */
package com.hst.test;

import com.hst.common.util.Base64;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Test2 {
    public static void main(String[] args) {
        String filePath = "D:\\head\\\u529e\u7a0e\u670d\u52a1\u5385\u8058\u7528\u5236\u4eba\u5458\u7167\u7247";
        File file = new File(filePath);
        if (file.exists()) {
            File[] files;
            File[] fileArray = files = file.listFiles();
            int n = files.length;
            int n2 = 0;
            while (n2 < n) {
                File f = fileArray[n2];
                String filename = f.getName().replace("+", "").replace("\u007f", "");
                String imgae2 = Base64.byteToString(Test2.getBytesFromFile(f.getPath())).replaceAll("\r\n", "");
                System.out.println(imgae2.length());
                System.out.println(filename.replaceAll("[^\\u4e00-\\u9fa5]", ""));
                ++n2;
            }
        }
    }

    public static byte[] getBytesFromFile(String filePath) {
        File f = new File(filePath);
        if (f.isDirectory()) {
            return null;
        }
        try {
            int n;
            FileInputStream stream = new FileInputStream(f);
            ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
            byte[] b = new byte[1024];
            while ((n = stream.read(b)) != -1) {
                out.write(b, 0, n);
            }
            stream.close();
            out.close();
            return out.toByteArray();
        }
        catch (IOException iOException) {
            return null;
        }
    }
}
