| | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipInputStream; |
| | | |
| | | public class ZipAndRarUtil { |
| | |
| | | ZipInputStream zipInputStream = null; |
| | | try{ |
| | | FileInputStream inputStream = new FileInputStream(zipFileName); |
| | | zipInputStream = new ZipInputStream( |
| | | new BufferedInputStream(inputStream), StandardCharsets.UTF_8); |
| | | zipInputStream = new ZipInputStream(new BufferedInputStream(inputStream), StandardCharsets.ISO_8859_1); |
| | | java.util.zip.ZipEntry ze; |
| | | List<FileMessage> list = new ArrayList<>(); |
| | | //循环遍历 |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String zipFile="D:\\IDEAWorkSpace\\CadDrawManager\\target\\doc_file\\ABE-0220NT PCBA专用结构件BOM表_A01(2020-6-19).zip"; |
| | | List<FileMessage> list=new ArrayList(); |
| | | try { |
| | | list=ZipAndRarUtil.getZipFileList(zipFile); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | for (FileMessage f:list) { |
| | | System.out.println(f.toString()); |
| | | } |
| | | } |
| | | |
| | | } |