java.util.zip

Class ZipEntry

Implemented Interfaces:
Cloneable, java.util.zip.ZipConstants
Known Direct Subclasses:
JarEntry

public class ZipEntry
extends Object
implements java.util.zip.ZipConstants, Cloneable

This class is used to represent a ZIP file entry.

Field Summary

static int
DEFLATED
Compression method for compressed (deflated) entries.
static int
STORED
Compression method for uncompressed entries.

Fields inherited from interface java.util.zip.ZipConstants

CENATT, CENATX, CENCOM, CENCRC, CENDSK, CENEXT, CENFLG, CENHDR, CENHOW, CENLEN, CENNAM, CENOFF, CENSIG, CENSIZ, CENTIM, CENVEM, CENVER, ENDCOM, ENDHDR, ENDOFF, ENDSIG, ENDSIZ, ENDSUB, ENDTOT, EXTCRC, EXTHDR, EXTLEN, EXTSIG, EXTSIZ, LOCCRC, LOCEXT, LOCFLG, LOCHDR, LOCHOW, LOCLEN, LOCNAM, LOCSIG, LOCSIZ, LOCTIM, LOCVER

Constructor Summary

ZipEntry(String name)
Creates a new zip entry with the specified name.
ZipEntry(ZipEntry e)
Creates a new zip entry with fields taken from the specified zip entry.

Method Summary

Object
clone()
Returns a copy of this entry.
String
getComment()
Returns the comment string for the entry, or null if none.
long
getCompressedSize()
Returns the size of the compressed entry data, or -1 if not known.
long
getCrc()
Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.
byte[]
getExtra()
Returns the extra field data for the entry, or null if none.
int
getMethod()
Returns the compression method of the entry, or -1 if not specified.
String
getName()
Returns the name of the entry.
long
getSize()
Returns the uncompressed size of the entry data, or -1 if not known.
long
getTime()
Returns the modification time of the entry, or -1 if not specified.
int
hashCode()
Returns the hash code value for this entry.
boolean
isDirectory()
Returns true if this is a directory entry.
void
setComment(String comment)
Sets the optional comment string for the entry.
void
setCompressedSize(long csize)
Sets the size of the compressed entry data.
void
setCrc(long crc)
Sets the CRC-32 checksum of the uncompressed entry data.
void
setExtra(byte[] extra)
Sets the optional extra field data for the entry.
void
setMethod(int method)
Sets the compression method for the entry.
void
setSize(long size)
Sets the uncompressed size of the entry data.
void
setTime(long time)
Sets the modification time of the entry.
String
toString()
Returns a string representation of the ZIP entry.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

DEFLATED

public static final int DEFLATED
Compression method for compressed (deflated) entries.
Field Value:
8
Usages and Demos :

View More Examples of ZipEntry.DEFLATED
   1:     switch(method) {
   2:       case java.util.zip.ZipEntry.DEFLATED:
   3:         return "deflated";
   4:       case java.util.zip.ZipEntry.STORED:
   5:         return "stored";

View Full Code Here
   1:                     ZipEntry outentry = new ZipEntry(zipentry.getName());
   2:                     outentry.setMethod(ZipEntry.DEFLATED);
   3:                     zipout.putNextEntry(outentry);
   4:                     LFileCopy.copy(tmpout, zipout);
   5:                     zipout.closeEntry();

View Full Code Here
   1:             entry.setTime(System.currentTimeMillis());
   2:             entry.setMethod(ZipEntry.DEFLATED);
   3:             zip.putNextEntry(entry);
   4:             zip.write (inflatedData, 0, inflatedData.length);
   5:             zip.closeEntry();

View Full Code Here
   1:                 entry.setTime(System.currentTimeMillis());
   2:                 entry.setMethod(ZipEntry.DEFLATED);
   3:                 zip.putNextEntry(entry);
   4:                 byte[] data = item.getData();
   5:                 zip.write (data, 0, data.length);

View Full Code Here
   1: 
   2:             ZipEntry ze = createZipEntry(name, bytes, ZipEntry.DEFLATED);
   3:             Entry entry = new Entry(ze, bytes);
   4:             entryList.add(entry);
   5:             index = entryList.size() - 1;

View Full Code Here

STORED

public static final int STORED
Compression method for uncompressed entries.
Field Value:
0
Usages and Demos :

View More Examples of ZipEntry.STORED
   1:         ZipEntry entry = new ZipEntry(localPath);
   2:         entry.setMethod(ZipEntry.STORED);
   3:         entry.setCompressedSize(size);
   4:         entry.setSize(size);
   5:         entry.setCrc(crc);

View Full Code Here
   1:         if (!useCompression) {
   2:             entry.setMethod(ZipEntry.STORED);
   3:             InputStream contentStream = contents.getContents(false);
   4:             int length = 0;
   5:             CRC32 checksumCalculator = new CRC32();

View Full Code Here
   1:         return "deflated";
   2:       case java.util.zip.ZipEntry.STORED:
   3:         return "stored";
   4:       default:
   5:         return method.toString();

View Full Code Here
   1:     public int getMethod() {
   2:         return ZipEntry.STORED;
   3:     }
   4: 
   5:     public void setMethod(int method) {

View Full Code Here
   1:         if (je.ze.getName().endsWith("/")) continue;
   2:         je.ze.setMethod(ZipEntry.STORED);
   3:         je.ze.setCompressedSize(je.ze.getSize());
   4:         zout.putNextEntry(je.ze);
   5:         InputStream is = (je.location < 0) ? zfmast.getInputStream(je.ze) :

View Full Code Here

Constructor Details

ZipEntry

public ZipEntry(String name)
Creates a new zip entry with the specified name.
Parameters:
name - the entry name
Throws:
NullPointerException - if the entry name is null
IllegalArgumentException - if the entry name is longer than 0xFFFF bytes
Usages and Demos :

View More Examples of ZipEntry(String name)
   1:         if (empty) {
   2:             putNextEntry(new ZipEntry("."));
   3:             closeEntry();
   4:         }
   5:         super.close();

View Full Code Here
   1:         registerLocalPath(localPath);
   2:         zipStream.putNextEntry(new ZipEntry(localPath));
   3:         return zipStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         ZipEntry entry = new ZipEntry(localPath);
   7:         entry.setMethod(ZipEntry.STORED);
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setSize(path.length());

View Full Code Here
   1: 
   2:         ZipEntry newEntry = new ZipEntry(pathname.toString());
   3:         directoryEntryCache.put(pathname, newEntry);
   4:         addToChildren(parent, newEntry);
   5:     }

View Full Code Here
   1:         }
   2:         ZipEntry newEntry = new ZipEntry(pathname.toString());
   3:         directoryEntryCache.put(pathname, newEntry);
   4:         List childList = new ArrayList();
   5:         children.put(newEntry, childList);

View Full Code Here
   1:         {
   2:             ZipEntry entry = new ZipEntry("CompiereArchive");
   3:             entry.setTime(System.currentTimeMillis());
   4:             entry.setMethod(ZipEntry.DEFLATED);
   5:             zip.putNextEntry(entry);

View Full Code Here

ZipEntry

public ZipEntry(ZipEntry e)
Creates a new zip entry with fields taken from the specified zip entry.
Parameters:
e - a zip Entry object
Usages and Demos :

View More Examples of ZipEntry(ZipEntry e)
   1:         if (empty) {
   2:             putNextEntry(new ZipEntry("."));
   3:             closeEntry();
   4:         }
   5:         super.close();

View Full Code Here
   1:         registerLocalPath(localPath);
   2:         zipStream.putNextEntry(new ZipEntry(localPath));
   3:         return zipStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         ZipEntry entry = new ZipEntry(localPath);
   7:         entry.setMethod(ZipEntry.STORED);
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setSize(path.length());

View Full Code Here
   1: 
   2:         ZipEntry newEntry = new ZipEntry(pathname.toString());
   3:         directoryEntryCache.put(pathname, newEntry);
   4:         addToChildren(parent, newEntry);
   5:     }

View Full Code Here
   1:         }
   2:         ZipEntry newEntry = new ZipEntry(pathname.toString());
   3:         directoryEntryCache.put(pathname, newEntry);
   4:         List childList = new ArrayList();
   5:         children.put(newEntry, childList);

View Full Code Here
   1:         {
   2:             ZipEntry entry = new ZipEntry("CompiereArchive");
   3:             entry.setTime(System.currentTimeMillis());
   4:             entry.setMethod(ZipEntry.DEFLATED);
   5:             zip.putNextEntry(entry);

View Full Code Here

Method Details

clone

public Object clone()
Returns a copy of this entry.
Overrides:
clone in interface Object
Usages and Demos :

View More Examples of clone()
   1: import java.util.Vector;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5:                 for (Enumeration e = zfile.entries(); e.hasMoreElements();) {
   6:                     ZipEntry entry = (ZipEntry) e.nextElement();
   7:                     String entryName = entry.getName();
   8:         ...
   9:                     InputStream in = zfile.getInputStream(entry);
  10:                     zout.putNextEntry((ZipEntry) entry.clone());
  11:                     int n;

View Full Code Here

getComment

public String getComment()
Returns the comment string for the entry, or null if none.
Returns:
the comment string for the entry, or null if none
Usages and Demos :

View More Examples of getComment()
   1: import java.util.zip.ZipFile;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipException;
   4:         ...
   5:         while (entries.hasMoreElements()) {
   6:             ZipEntry inputEntry = (ZipEntry) entries.nextElement();
   7:             String inputEntryName = inputEntry.getName();
   8:         ...
   9:         outputEntry.setExtra(inputEntry.getExtra());
  10:         outputEntry.setComment(inputEntry.getComment());
  11:         outputEntry.setTime(inputEntry.getTime());

View Full Code Here

getCompressedSize

public long getCompressedSize()
Returns the size of the compressed entry data, or -1 if not known. In the case of a stored entry, the compressed size will be the same as the uncompressed size of the entry.
Returns:
the size of the compressed entry data, or -1 if not known
Usages and Demos :

View More Examples of getCompressedSize()
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5: 
   6:     for ( Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements(); )
   7:     {
   8:         ...
   9:       ZipEntry entry = e.nextElement();
  10: 
  11:         ...
  12:                          entry.getSize(),
  13:                          entry.getCompressedSize(),

View Full Code Here
   1: import java.io.InputStream;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipInputStream;
   4:         ...
   5: 
   6:     private ZipEntry entry;
   7: 
   8:         ...
   9: 
  10:     public ZipEntry getNextEntry() throws IOException {
  11:         return entry = super.getNextEntry();
  12:         ...
  13:     public InputStream getRawInput() {
  14:         long size = entry.getCompressedSize();

View Full Code Here
   1: 
   2:       ZipEntry myZipEntry = new ZipEntry(fileName); 
   3:       myZipFile.putNextEntry(myZipEntry);
   4:         ...
   5:       System.out.println("Compressed file size = " +
   6:                                           myZipEntry.getCompressedSize());
   7:     }
   8:     {
   9:       System.out.println("IOException " + e + " occurred");

View Full Code Here
   1: 
   2:     private String dumpZipEntry(ZipEntry ze)
   3:     {
   4:         ...
   5: 
   6:                 if (ze.getMethod()==ZipEntry.STORED)
   7:                         sb += "stored   ";
   8:         ...
   9:                 sb += ""+ze.getSize();
  10:                 if (ze.getMethod()==ZipEntry.DEFLATED)
  11:         ...
  12:                         sb += "/"+ze.getCompressedSize();

View Full Code Here
   1: import java.util.logging.Logger;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5: 
   6:   private final ZipEntry _entry;
   7:   private final BinaryInput _binaryInput;
   8:         ...
   9: 
  10:   public QuercusZipEntry(ZipEntry zipEntry,
  11:                          BinaryInput binaryInput,
  12:         ...
  13: 
  14:     return _entry.getCompressedSize();

View Full Code Here

getCrc

public long getCrc()
Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.
Returns:
the CRC-32 checksum of the uncompressed entry data, or -1 if not known
See Also:
getCrc()
Usages and Demos :

View More Examples of getCrc()
   1: import java.util.zip.ZipFile;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipException;
   4:         ...
   5:         while (entries.hasMoreElements()) {
   6:             ZipEntry inputEntry = (ZipEntry) entries.nextElement();
   7:             String inputEntryName = inputEntry.getName();
   8:         ...
   9:             outputEntry.setMethod(ZipEntry.STORED);
  10:             outputEntry.setCrc(inputEntry.getCrc());
  11:             outputEntry.setSize(inputEntry.getSize());

View Full Code Here

getExtra

public byte[] getExtra()
Returns the extra field data for the entry, or null if none.
Returns:
the extra field data for the entry, or null if none
Usages and Demos :

View More Examples of getExtra()
   1: import java.util.zip.ZipFile;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipException;
   4:         ...
   5:         while (entries.hasMoreElements()) {
   6:             ZipEntry inputEntry = (ZipEntry) entries.nextElement();
   7:             String inputEntryName = inputEntry.getName();
   8:         ...
   9:         outputEntry.setTime(inputEntry.getTime());
  10:         outputEntry.setExtra(inputEntry.getExtra());
  11:         outputEntry.setComment(inputEntry.getComment());

View Full Code Here

getMethod

public int getMethod()
Returns the compression method of the entry, or -1 if not specified.
Returns:
the compression method of the entry, or -1 if not specified
Usages and Demos :

View More Examples of getMethod()
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5:             for (Enumeration e = zip.entries(); e.hasMoreElements();) {
   6:                 ZipEntry ze = (ZipEntry) e.nextElement();
   7: 
   8:         ...
   9:                 transformedZe.setCrc(crc.getValue());
  10:                 transformedZe.setMethod(ze.getMethod());
  11:                 zos.putNextEntry(transformedZe);

View Full Code Here

getName

public String getName()
Returns the name of the entry.
Returns:
the name of the entry
Usages and Demos :

View More Examples of getName()
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5: 
   6:     for ( Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements(); )
   7:     {
   8:         ...
   9:       ZipEntry entry = e.nextElement();
  10: 
  11:         ...
  12:                          entry.isDirectory() ? "+" : " ",
  13:                          entry.getName(),

View Full Code Here
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5:             {
   6:                 ZipEntry entry = (ZipEntry) e.nextElement();
   7:                 if (isDataFile(entry))
   8:         ...
   9:                 {
  10:                     log("Processing " + entry.getName() + "...");
  11:                     
  12:         ...
  13:                     {
  14:                         log("Couldn't process " + entry.getName() + ": " + ipe.getMessage(), Project.MSG_ERR);

View Full Code Here
   1:     private DataEntry      parent;
   2:     private ZipEntry       zipEntry;
   3:     private ZipInputStream zipInputStream;
   4:         ...
   5:     public ZipDataEntry(DataEntry      parent,
   6:                         ZipEntry       zipEntry,
   7:                         ZipInputStream zipInputStream)
   8:         ...
   9:     {
  10:         return zipEntry.getName()
  11:             .replace(File.separatorChar, ClassConstants.INTERNAL_PACKAGE_SEPARATOR);

View Full Code Here
   1: import java.util.jar.Manifest;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:       {
   6:         ZipEntry entry = (ZipEntry) e.nextElement();
   7:         ...
   8:         if (writtenItems.contains(entry.getName()))
   9:           continue;
  10:         ...
  11:         writeFile(entry.isDirectory(), inputJar.getInputStream(entry),
  12:                   entry.getName(), parameters.verbose);

View Full Code Here
   1:     File        src_file, dst_file;
   2:     ZipEntry    entry;
   3:     FileInputStream        fis;
   4:         ...
   5:         while ( (entry = zis.getNextEntry()) != null ) {
   6:         zos.putNextEntry(new ZipEntry(entry.getName()));
   7:         while ( (nbr_bytes_read = zis.read(byte_buf)) >= 0 ) {
   8:         ...
   9:             if ( entry.getName().equals(SerialNumberManager.STR_VERSION_ENTRY_NAME) ) {
  10:             version = new String(byte_buf, 0, nbr_bytes_read);
  11:         ...
  12:         
  13:         zos.putNextEntry(new ZipEntry(SerialNumberManager.STR_REG_INFO_ENTRY_NAME));

View Full Code Here

getSize

public long getSize()
Returns the uncompressed size of the entry data, or -1 if not known.
Returns:
the uncompressed size of the entry data, or -1 if not known
See Also:
setSize(long)
Usages and Demos :

View More Examples of getSize()
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5: 
   6:     for ( Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements(); )
   7:     {
   8:         ...
   9:       ZipEntry entry = e.nextElement();
  10: 
  11:         ...
  12:                          entry.getName(),
  13:                          entry.getSize(),

View Full Code Here
   1: import java.net.URL;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5: public class ZipBundleEntry extends BundleEntry {
   6:     protected ZipEntry zipEntry;
   7: 
   8:         ...
   9:     public long getSize() {
  10:         return zipEntry.getSize();
  11:     }

View Full Code Here
   1: 
   2:     ZipEntry entry;
   3: 
   4:         ...
   5:         public Zipped(String name, ZipFile zdir, ZipEntry entry) {
   6:         this.name = name;
   7:         ...
   8:         public long length() {
   9:         return entry.getSize();
  10:     }

View Full Code Here
   1:         ZipFile   zipFile  = new ZipFile(archive);
   2:         ZipEntry  zipEntry = zipFile.getEntry(className);
   3: 
   4:         ...
   5:         if (zipEntry == null)
   6:             return null;
   7:         ...
   8:             
   9:         byte bytes[] = new byte[(int) zipEntry.getSize()];
  10:         InputStream inputStream = zipFile.getInputStream(zipEntry);
  11:         ...
  12:         
  13:         limit = (int)zipEntry.getSize();

View Full Code Here
   1: import java.util.HashSet;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:     private final ZipFileSystem fs;
   6:     protected ZipEntry entry;
   7:     private FileType type;
   8:         ...
   9:     protected ZipFileObject(FileName name,
  10:                             ZipEntry entry,
  11:                             ZipFileSystem fs,
  12:         ...
  13:     {
  14:         return entry.getSize();

View Full Code Here

getTime

public long getTime()
Returns the modification time of the entry, or -1 if not specified.
Returns:
the modification time of the entry, or -1 if not specified
See Also:
setTime(long)
Usages and Demos :

View More Examples of getTime()
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5: 
   6:     for ( Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements(); )
   7:     {
   8:         ...
   9:       ZipEntry entry = e.nextElement();
  10: 
  11:         ...
  12:                          entry.getCompressedSize(),
  13:                          entry.getTime() );

View Full Code Here
   1:   public static void main(String argv[]) {
   2:         ZipEntry testentry = new ZipEntry(testString);
   3: 
   4:         ...
   5:         Date date = new Date();
   6:         long dummytime = date.getTime();
   7:         testentry.setTime(dummytime);
   8:         ...
   9:         long newtime = testentry.getTime();
  10:         System.out.println("dummytime "+ dummytime);

View Full Code Here
   1: import java.net.URL;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5: public class ZipBundleEntry extends BundleEntry {
   6:     protected ZipEntry zipEntry;
   7: 
   8:         ...
   9:     public long getTime() {
  10:         return zipEntry.getTime();
  11:     }

View Full Code Here
   1: 
   2:     ZipEntry entry;
   3: 
   4:         ...
   5:         public Zipped(String name, ZipFile zdir, ZipEntry entry) {
   6:         this.name = name;
   7:         ...
   8:         long lastMod() {
   9:         return entry.getTime();
  10:     }

View Full Code Here
   1: import java.util.HashSet;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:     private final ZipFileSystem fs;
   6:     protected ZipEntry entry;
   7:     private FileType type;
   8:         ...
   9:     protected ZipFileObject(FileName name,
  10:                             ZipEntry entry,
  11:                             ZipFileSystem fs,
  12:         ...
  13:     {
  14:         return entry.getTime();

View Full Code Here

hashCode

public int hashCode()
Returns the hash code value for this entry.
Overrides:
hashCode in interface Object

isDirectory

public boolean isDirectory()
Returns true if this is a directory entry. A directory entry is defined to be one whose name ends with a '/'.
Returns:
true if this is a directory entry
Usages and Demos :

View More Examples of isDirectory()
   1: import java.util.Enumeration;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5: 
   6:     for ( Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements(); )
   7:     {
   8:         ...
   9:       ZipEntry entry = e.nextElement();
  10: 
  11:         ...
  12:       System.out.printf( "%s%-54s   Size: %6d   Packed: %6d   %tc%n", 
  13:                          entry.isDirectory() ? "+" : " ",

View Full Code Here
   1:     File parent;
   2:     ZipEntry entry;
   3:     
   4:         ...
   5:         
   6:         if(entry.isDirectory()) {
   7:             tmp = path.substring(0,path.length()-1);
   8:         ...
   9:     public String getPath() { return path; }
  10:     public boolean isDirectory() { return entry.isDirectory(); }
  11:     public boolean isAbsolute() { return true; }

View Full Code Here
   1: import java.util.jar.Manifest;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:       {
   6:         ZipEntry entry = (ZipEntry) e.nextElement();
   7:         if (writtenItems.contains(entry.getName()))
   8:         ...
   9:           continue;
  10:         writeFile(entry.isDirectory(), inputJar.getInputStream(entry),
  11:                   entry.getName(), parameters.verbose);

View Full Code Here
   1: import java.net.URL;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipException;
   4:         ...
   5:       ZipInputStream zipStream = new ZipInputStream(urlStream);
   6:       ZipEntry entry = null;
   7: 
   8:         ...
   9:       }
  10:       while(entry.isDirectory() || !entry.getName().toLowerCase().endsWith(".xml"));
  11: 
  12:         ...
  13:       ZipInputStream zipStream = new ZipInputStream(urlStream);
  14:       ZipEntry entry = null;

View Full Code Here
   1: import java.util.jar.JarFile;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:         
   6:         public JarAsDirectory(String jarpath, ZipEntry entry)
   7:         {
   8:         ...
   9:         {
  10:             return entry==null || entry.isDirectory();
  11:         }
  12:         ...
  13:                         String    dir    = "/";
  14:                         ZipEntry    entry    = (ZipEntry)e.nextElement();

View Full Code Here

setComment

public void setComment(String comment)
Sets the optional comment string for the entry.
Parameters:
comment - the comment string
Throws:
IllegalArgumentException - if the length of the specified comment string is greater than 0xFFFF bytes
See Also:
getComment()

setCompressedSize

public void setCompressedSize(long csize)
Sets the size of the compressed entry data.
Parameters:
csize - the compressed size to set to
Usages and Demos :

View More Examples of setCompressedSize(long csize)
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         zipStream.putNextEntry(new ZipEntry(localPath));
   7:         return zipStream;
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setMethod(ZipEntry.STORED);
  12:         ...
  13:         entry.setCompressedSize(size);

View Full Code Here

setCrc

public void setCrc(long crc)
Sets the CRC-32 checksum of the uncompressed entry data.
Parameters:
crc - the CRC-32 value
Throws:
IllegalArgumentException - if the specified CRC-32 value is less than 0 or greater than 0xFFFFFFFF
See Also:
setCrc(long)
Usages and Demos :

View More Examples of setCrc(long crc)
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         zipStream.putNextEntry(new ZipEntry(localPath));
   7:         return zipStream;
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setMethod(ZipEntry.STORED);
  12:         ...
  13:         entry.setSize(size);
  14:         entry.setCrc(crc);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5: 
   6:     private void write(ZipEntry entry, IFile contents) throws IOException, CoreException {
   7:         byte[] readBuffer = new byte[4096];
   8:         ...
   9:         if (!useCompression) {
  10:             entry.setMethod(ZipEntry.STORED);
  11:             InputStream contentStream = contents.getContents(false);
  12:         ...
  13:             entry.setSize(length);
  14:             entry.setCrc(checksumCalculator.getValue());

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5: 
   6:     ZipEntry entry = new ZipEntry(filename);
   7:         ...
   8:     entry.setCrc(crc.getValue());
   9:     entry.setSize(size);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.lang.reflect.Method;
   4:         ...
   5:         at.putValue("Created-By", "AspectWerkz (c) Plug [java " + System.getProperty("java.version") + ']');
   6:         ZipEntry entry = new ZipEntry("java/lang/ClassLoader.class");
   7:         entry.setSize(patched.length);
   8:         ...
   9:         crc.update(patched);
  10:         entry.setCrc(crc.getValue());
  11:         JarOutputStream jar = new JarOutputStream(new FileOutputStream(dest), mf);

View Full Code Here
   1: 
   2:     ZipEntry e = new ZipEntry(name);
   3: 
   4:         ...
   5:     if (markOnly) {
   6:         e.setMethod(ZipEntry.STORED);
   7:         e.setSize(0);
   8:         ...
   9:         e.setCrc(0);
  10:     }

View Full Code Here

setExtra

public void setExtra(byte[] extra)
Sets the optional extra field data for the entry.
Parameters:
extra - the extra field data bytes
Throws:
IllegalArgumentException - if the length of the specified extra field data is greater than 0xFFFF bytes
See Also:
getExtra()
Usages and Demos :

View More Examples of setExtra(byte[] extra)
   1:                             
   2:             ZipEntry entry = new ZipEntry("readme.txt");
   3:         ...
   4:             entry.setExtra(assetInfo);
   5:             zip.putNextEntry(entry);
   6:         ...
   7:             
   8:             entry = new ZipEntry(dl_name);
   9:         ...
  10:             entry.setExtra(assetInfo);

View Full Code Here
   1: import java.util.zip.Deflater;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5: 
   6:         ZipEntry ze = new ZipEntry(java.net.URLEncoder.encode(path, "UTF-8"));
   7:         ...
   8:         ze.setExtra(uid.getBytes("UTF-8"));
   9:         zos.putNextEntry(ze);

View Full Code Here
   1:  
   2:     ZipEntry ze = new ZipEntry(name_str);
   3: 
   4:         ...
   5:     if (compressed) {
   6:         ze.setMethod(ZipEntry.DEFLATED);
   7:     } else {
   8:         ...
   9: 
  10:     ze.setExtra(extra);

View Full Code Here

setMethod

public void setMethod(int method)
Sets the compression method for the entry.
Parameters:
method - the compression method, either STORED or DEFLATED
Throws:
IllegalArgumentException - if the specified compression method is invalid
See Also:
getMethod()
Usages and Demos :

View More Examples of setMethod(int method)
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         zipStream.putNextEntry(new ZipEntry(localPath));
   7:         return zipStream;
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         ...
  12:         entry.setMethod(ZipEntry.STORED);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5: 
   6:     private void write(ZipEntry entry, IFile contents) throws IOException, CoreException {
   7:         byte[] readBuffer = new byte[4096];
   8:         ...
   9:         if (!useCompression) {
  10:             entry.setMethod(ZipEntry.STORED);
  11:             InputStream contentStream = contents.getContents(false);
  12:         ...
  13:             throws IOException, CoreException {
  14:         ZipEntry newEntry = new ZipEntry(destinationPath);

View Full Code Here
   1:             ZipInputStream zip = new ZipInputStream (in);
   2:             ZipEntry entry = zip.getNextEntry();
   3:             {
   4:         ...
   5:         ZipOutputStream zip = new ZipOutputStream(out);
   6:         zip.setMethod(ZipOutputStream.DEFLATED);
   7:         zip.setLevel(Deflater.BEST_COMPRESSION);
   8:         ...
   9:         {
  10:             ZipEntry entry = new ZipEntry("CompiereArchive");
  11:             entry.setTime(System.currentTimeMillis());
  12:         ...
  13:             entry.setMethod(ZipEntry.DEFLATED);

View Full Code Here
   1: 
   2:     ZipEntry e = new ZipEntry(name);
   3: 
   4:         ...
   5:     if (markOnly) {
   6:         e.setMethod(ZipEntry.STORED);
   7:         e.setSize(0);
   8:         ...
   9:     ZipInputStream zis = new ZipInputStream(in);
  10:     ZipEntry e;
  11:     while ((e = zis.getNextEntry()) != null) {

View Full Code Here
   1: import java.util.jar.Manifest;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:          prefix = prefix + src.getName() + "/";
   6:          ZipEntry entry = new ZipEntry(prefix);
   7:          entry.setTime(src.lastModified());
   8:         ...
   9:          entry.setMethod(JarOutputStream.STORED);
  10:          entry.setSize(0L);

View Full Code Here

setSize

public void setSize(long size)
Sets the uncompressed size of the entry data.
Parameters:
size - the uncompressed size in bytes
Throws:
IllegalArgumentException - if the specified size is less than 0 or greater than 0xFFFFFFFF bytes
See Also:
getSize()
Usages and Demos :

View More Examples of setSize(long size)
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         zipStream.putNextEntry(new ZipEntry(localPath));
   7:         return zipStream;
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setMethod(ZipEntry.STORED);
  12:         ...
  13:         entry.setCompressedSize(size);
  14:         entry.setSize(size);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5: 
   6:     private void write(ZipEntry entry, IFile contents) throws IOException, CoreException {
   7:         byte[] readBuffer = new byte[4096];
   8:         ...
   9:         if (!useCompression) {
  10:             entry.setMethod(ZipEntry.STORED);
  11:             InputStream contentStream = contents.getContents(false);
  12:         ...
  13: 
  14:             entry.setSize(length);

View Full Code Here
   1: import java.util.jar.Manifest;
   2: import java.util.zip.ZipEntry;
   3: 
   4:         ...
   5:     {
   6:         ZipEntry entry = new ZipEntry(name);
   7:         ...
   8:         entry.setSize(file.length());
   9:         jos.putNextEntry(entry);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.lang.reflect.Method;
   4:         ...
   5:         at.putValue("Created-By", "AspectWerkz (c) Plug [java " + System.getProperty("java.version") + ']');
   6:         ZipEntry entry = new ZipEntry("java/lang/ClassLoader.class");
   7:         ...
   8:         entry.setSize(patched.length);
   9:         CRC32 crc = new CRC32();

View Full Code Here
   1: 
   2:     ZipEntry e = new ZipEntry(name);
   3: 
   4:         ...
   5:     if (markOnly) {
   6:         e.setMethod(ZipEntry.STORED);
   7:         ...
   8:         e.setSize(0);
   9:         e.setCrc(0);

View Full Code Here

setTime

public void setTime(long time)
Sets the modification time of the entry.
Parameters:
time - the entry modification time in number of milliseconds since the epoch
See Also:
getTime()
Usages and Demos :

View More Examples of setTime(long time)
   1:   public static void main(String argv[]) {
   2:         ZipEntry testentry = new ZipEntry(testString);
   3: 
   4:         ...
   5:         long dummytime = date.getTime();
   6:         testentry.setTime(dummytime);
   7:         long newtime = testentry.getTime();
   8:         System.out.println("dummytime "+ dummytime);
   9:         System.out.println("newtime "+ newtime);

View Full Code Here
   1: import java.util.zip.CRC32;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:         registerLocalPath(localPath);
   6:         zipStream.putNextEntry(new ZipEntry(localPath));
   7:         return zipStream;
   8:         ...
   9:         registerLocalPath(localPath);
  10:         ZipEntry entry = new ZipEntry(localPath);
  11:         entry.setMethod(ZipEntry.STORED);
  12:         ...
  13:         entry.setCrc(crc.getValue());
  14:         entry.setTime(path.lastModified());

View Full Code Here
   1:             ZipInputStream zip = new ZipInputStream (in);
   2:             ZipEntry entry = zip.getNextEntry();
   3:             {
   4:         ...
   5:         {
   6:             ZipEntry entry = new ZipEntry("CompiereArchive");
   7:         ...
   8:             entry.setTime(System.currentTimeMillis());
   9:             entry.setMethod(ZipEntry.DEFLATED);

View Full Code Here
   1:         
   2:         ZipEntry ze = null;
   3:         byte buf[] = new byte[1024];
   4:         ...
   5:         for (int i = 0; metaFiles != null && i < metaFiles.size(); i++) {
   6:             ze = new ZipEntry("meta" + i);
   7:         ...
   8:             ze.setTime(0);
   9:             zo.putNextEntry(ze);
  10:         ...
  11:         for (int i = 0; entryFiles != null && i < entryFiles.size(); i++) {
  12:             ze = new ZipEntry("entry" + i);

View Full Code Here
   1: import java.io.*;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipOutputStream;
   4:         ...
   5:             try {
   6:                 ZipEntry entry = new ZipEntry(file.getName());
   7:         ...
   8:                 entry.setTime(file.lastModified());
   9:                 out.putNextEntry(entry);

View Full Code Here

toString

public String toString()
Returns a string representation of the ZIP entry.
Overrides:
toString in interface Object
Usages and Demos :

View More Examples of toString()
   1: 
   2:     return buf.toString();
   3:   }
   4:         ...
   5:     ClassFile getClassFile(String name, String suffix) throws IOException {
   6:       final ZipEntry entry = zip.getEntry(name.replace('.', '/') + suffix);
   7: 
   8:         ...
   9:     public InputStream getInputStream() throws IOException { return zip.getInputStream(entry); }
  10:     public String      getPath()        { return entry.toString(); }
  11:     public long        getTime()        { return entry.getTime(); }

View Full Code Here
   1: import java.util.StringTokenizer;
   2: import java.util.zip.ZipEntry;
   3: import java.util.zip.ZipFile;
   4:         ...
   5:         }
   6:         return buf.toString().intern();
   7:     }
   8:         ...
   9:         ClassFile getClassFile( String name, String suffix ) throws IOException {
  10:             final ZipEntry entry = zip.getEntry(name.replace('.', '/') + suffix);
  11:             return (entry != null) ? new ClassFile() {
  12:         ...
  13:                 public String getPath() {
  14:                     return entry.toString();

View Full Code Here