Java by API/java.util.zip/ZipInputStream — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 17:43, 31 мая 2010

new ZipInputStream(InputStream in)

 
import java.io.FileInputStream;
import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class Main {
  public static void main(String[] args) throws Exception {
    FileInputStream fis = new FileInputStream(args[0]);
    ZipInputStream zis = new ZipInputStream(fis);
    ZipEntry ze;
    while ((ze = zis.getNextEntry()) != null)
      System.out.println(ze.getName() + "  [" + ze.getSize() + "]  ["
          + new Date(ze.getTime()).toString() + "]");
  }
}





ZipInputStream: getNextEntry()

 
import java.io.FileInputStream;
import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class Main {
  public static void main(String[] args) throws Exception {
    FileInputStream fis = new FileInputStream(args[0]);
    ZipInputStream zis = new ZipInputStream(fis);
    ZipEntry ze;
    while ((ze = zis.getNextEntry()) != null)
      System.out.println(ze.getName() + "  [" + ze.getSize() + "]  ["
          + new Date(ze.getTime()).toString() + "]");
  }
}