import org.apache.log4j.Logger;
import java.io.*;
import java.util.ArrayList;
import com.ljqc.license.entity.pg.FilePathNode;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.io.ZipInputStream;
import net.lingala.zip4j.model.FileHeader;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.FileUtils;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
/**
* description:文件工具类
**/
@Slf4j
@Component
public class FileUtil {
private static Logger logger = Logger.getLogger(FileUtil.class);
/**
* 获取所有路径
*/
public static ArrayList<String> getAllPath(String path) {
ArrayList<String> paths = new ArrayList<String>();
File fpath = new File(path);
getAllPath(fpath, paths);
return paths;
}
/**
* 递归获取一个目录下的所有文件
*/
public static void getAllPath(File path, ArrayList<String> paths) {
File[] fs = path.listFiles();
if (fs != null) {
for (int i = 0; i < fs.length; i++) {
if (java.nio.file.Files.isSymbolicLink(fs[i].toPath())) {
continue;
}
if (fs[i].isDirectory()) {
getAllPath(fs[i], paths);
}
if (fs[i].isFile()) {
paths.add(fs[i].toString());
}
}