How to read file from ZIP using InputStream?

后端 未结 7 862
旧巷少年郎
旧巷少年郎 2020-11-29 09:11

I must get file content from ZIP archive (only one file, I know its name) using SFTP. The only thing I\'m having is ZIP\'s InputStream. Most examples show how g

7条回答
  •  一向
    一向 (楼主)
    2020-11-29 09:33

    Well, I've done this:

     zipStream = new ZipInputStream(channelSftp.get("Port_Increment_201405261400_2251.zip"));
     zipStream.getNextEntry();
    
     sc = new Scanner(zipStream);
     while (sc.hasNextLine()) {
         System.out.println(sc.nextLine());
     }
    

    It helps me to read ZIP's content without writing to another file.

提交回复
热议问题