需求描述:
实现一个接口,接收zip文件的时候读取有压缩包里边的excel或csv表格里边的数据
有如下接口:
@RestController
@RequestMapping("/")
public class Controller {
@GetMapping("index")
public void test(MultipartFile file) {
try {
InputStream inputStream = file.getInputStream();
System.out.println(inputStream.available());
ZipEntry zipEntry;
ZipInputStream zipInputStream = new ZipInputStream(inputStream);
System.out.println(zipInputStream.available());
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
String fileName = zipEntry.getName();
System.out.println(fileName);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
问题描述:
inputStream 可以接收数据的内容,但是无法将数据流写到ZipInputStream,既【new ZipInputStream(inputStream);】无效,请问哪位有解决过类似的问题