java 代码
- package ziptest;
-
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.zip.ZipEntry;
- import java.util.zip.ZipInputStream;
-
-
-
-
-
- public class ZipTest {
- public static void main(String[] args) {
-
- try {
- ZipInputStream zin = new ZipInputStream(new FileInputStream(
- "d:/websale_rfid.zip"));
- FileInputStream filein = new FileInputStream("d:/websale_rfid.zip");
- ZipInputStream zin2 = new ZipInputStream(zin);
-
- ZipEntry entry;
- try {
- while ((entry = zin.getNextEntry()) != null) {
- System.out.println("++++++++++++++++" + (entry.getName()));
- zin.closeEntry();
- }
-
- while ((entry = zin2.getNextEntry()) != null) {
- System.out.println("~~~~~~~~~~~~~~~~~~" + (entry.getName()));
- zin2.closeEntry();
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
-
- }
-
-
输出为
++++++++++++++++forms.xml
++++++++++++++++gpd.xml
++++++++++++++++processdefinition.xml
++++++++++++++++processimage.jpg
而~~~~并没有输出
ZipInputStream zin2 = new ZipInputStream(zin); 为什么代码中zin2没能正确获得...???
如果我想重新读取一次zip流该怎么实现呢?------------------先不要告诉我根据FileInputStream再生成一次.......
直接根据原来的zip流不可以吗?