FileDocCategorySizeDatePackage
SerializableZipFile.javaAPI DocExample1784Sun Mar 28 19:08:08 BST 1999None

SerializableZipFile

public class SerializableZipFile extends Object implements Serializable

Fields Summary
ZipFile
zf
Constructors Summary
public SerializableZipFile(String filename)

    this.zf = new ZipFile(filename);
  
public SerializableZipFile(File file)

    this.zf = new ZipFile(file);
  
Methods Summary
public voidclose()

    zf.close();
  
public java.util.Enumerationentries()

    return zf.entries();
  
public java.util.zip.ZipEntrygetEntry(java.lang.String name)

    return zf.getEntry(name);
  
public java.io.InputStreamgetInputStream(java.util.zip.ZipEntry entry)

    return zf.getInputStream(entry);
  
public java.lang.StringgetName()

    return zf.getName();
  
public static voidmain(java.lang.String[] args)


    try {
      SerializableZipFile szf = new SerializableZipFile(args[0]);
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream oout = new ObjectOutputStream(bout);
      oout.writeObject(szf);
      oout.close();
      System.out.println("Wrote object!");

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream oin = new ObjectInputStream(bin);
      Object o = oin.readObject();
      System.out.println("Read object!");
    }
    catch (Exception e) {
      e.printStackTrace();
    }

  
private voidreadObject(java.io.ObjectInputStream in)

  
    String filename = (String) in.readObject();
    zf = new ZipFile(filename);
  
  
public intsize()

    return zf.size();
  
private voidwriteObject(java.io.ObjectOutputStream out)

    out.writeObject(zf.getName());