Build 1.0_r1(from source)

java.util.zip
Class ZipEntry

java.lang.Object
  extended by java.util.zip.ZipEntry
All Implemented Interfaces:
Cloneable, ZipConstants
Direct Known Subclasses:
JarEntry

public class ZipEntry
extends Object
implements ZipConstants, Cloneable

ZipEntry represents an entry in a zip file.

See Also:
ZipFile, ZipInputStream

Nested Class Summary
(package private) static class ZipEntry.LittleEndianReader
           
 
Field Summary
(package private)  String comment
           
(package private)  int commentLen
           
(package private)  long compressedSize
           
(package private)  int compressionMethod
           
(package private)  long crc
           
static int DEFLATED
          Zip entry state: Deflated
(package private)  byte[] extra
           
(package private)  int extraLen
           
(package private)  long mLocalHeaderRelOffset
           
(package private)  int modDate
           
(package private)  String name
           
(package private)  int nameLen
           
(package private)  long size
           
static int STORED
          Zip entry state: Stored
(package private)  int time
           
(package private) static int USES_DATA_DESCR
           
 
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)
          Constructs a new ZipEntry with the specified name.
ZipEntry(ZipEntry.LittleEndianReader ler, InputStream in)
           
ZipEntry(ZipEntry ze)
          Constructs a new ZipEntry using the values obtained from ze.
 
Method Summary
 Object clone()
          Returns a shallow copy of this entry
 String getComment()
          Gets the comment for this ZipEntry.
 long getCompressedSize()
          Gets the compressed size of this ZipEntry.
 long getCrc()
          Gets the crc for this ZipEntry.
 byte[] getExtra()
          Gets the extra information for this ZipEntry.
(package private)  int getGPBitFlag()
           
(package private)  long getLocalHeaderRelOffset()
           
 int getMethod()
          Gets the compression method for this ZipEntry.
 String getName()
          Gets the name of this ZipEntry.
 long getSize()
          Gets the uncompressed size of this ZipEntry.
 long getTime()
          Gets the last modification time of this ZipEntry.
 int hashCode()
          Returns the hashCode for this ZipEntry.
 boolean isDirectory()
          Determine whether or not this ZipEntry is a directory.
(package private) static long readIntLE(RandomAccessFile raf)
           
(package private) static int readShortLE(RandomAccessFile raf)
           
 void setComment(String string)
          Sets the comment for this ZipEntry.
 void setCompressedSize(long value)
          Sets the compressed size for this ZipEntry.
 void setCrc(long value)
          Sets the crc for this ZipEntry.
(package private)  void setDateTime(int lastModFileDate, int lastModFileTime)
           
 void setExtra(byte[] data)
          Sets the extra information for this ZipEntry.
(package private)  void setGPBitFlag(int flags)
           
(package private)  void setLocalHeaderRelOffset(long offset)
           
 void setMethod(int value)
          Sets the compression method for this ZipEntry.
 void setSize(long value)
          Sets the uncompressed size of this ZipEntry.
 void setTime(long value)
          Sets the last modification time of this ZipEntry.
(package private)  void setVersionToExtract(int version)
           
 String toString()
          Returns the string representation of this ZipEntry.
(package private)  int writeCDE(OutputStream out)
           
(package private)  int writeDD(OutputStream out)
           
(package private) static void writeIntLE(OutputStream out, long val)
           
(package private)  int writeLFH(OutputStream out)
           
(package private) static void writeShortLE(OutputStream out, int val)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

String name

comment

String comment

compressedSize

long compressedSize

crc

long crc

size

long size

compressionMethod

int compressionMethod

time

int time

modDate

int modDate

extra

byte[] extra

nameLen

int nameLen

extraLen

int extraLen

commentLen

int commentLen

mLocalHeaderRelOffset

long mLocalHeaderRelOffset

USES_DATA_DESCR

static final int USES_DATA_DESCR
See Also:
Constant Field Values

DEFLATED

public static final int DEFLATED
Zip entry state: Deflated

See Also:
Constant Field Values

STORED

public static final int STORED
Zip entry state: Stored

See Also:
Constant Field Values
Constructor Detail

ZipEntry

public ZipEntry(String name)
Constructs a new ZipEntry with the specified name.

Parameters:
name - the name of the zip entry

ZipEntry

public ZipEntry(ZipEntry ze)
Constructs a new ZipEntry using the values obtained from ze.

Parameters:
ze - ZipEntry from which to obtain values.

ZipEntry

ZipEntry(ZipEntry.LittleEndianReader ler,
         InputStream in)
   throws IOException
Throws:
IOException
Method Detail

getComment

public String getComment()
Gets the comment for this ZipEntry.

Returns:
the comment for this ZipEntry, or null if there is no comment Note the comment does not live in the LFH, only the CDE. This means that, if we're reading an archive with ZipInputStream, we won't be able to see the comments.

getCompressedSize

public long getCompressedSize()
Gets the compressed size of this ZipEntry.

Returns:
the compressed size, or -1 if the compressed size has not been set

getCrc

public long getCrc()
Gets the crc for this ZipEntry.

Returns:
the crc, or -1 if the crc has not been set

getExtra

public byte[] getExtra()
Gets the extra information for this ZipEntry.

Returns:
a byte array containing the extra information, or null if there is none

getMethod

public int getMethod()
Gets the compression method for this ZipEntry.

Returns:
the compression method, either DEFLATED, STORED or -1 if the compression method has not been set

getName

public String getName()
Gets the name of this ZipEntry.

Returns:
the entry name

getSize

public long getSize()
Gets the uncompressed size of this ZipEntry.

Returns:
the uncompressed size, or -1 if the size has not been set

getTime

public long getTime()
Gets the last modification time of this ZipEntry.

Returns:
the last modification time as the number of milliseconds since Jan. 1, 1970

isDirectory

public boolean isDirectory()
Determine whether or not this ZipEntry is a directory.

Returns:
true when this ZipEntry is a directory, false otherwise

setComment

public void setComment(String string)
Sets the comment for this ZipEntry.

Parameters:
string - the comment

setCompressedSize

public void setCompressedSize(long value)
Sets the compressed size for this ZipEntry.

Parameters:
value - the compressed size

setCrc

public void setCrc(long value)
Sets the crc for this ZipEntry.

Parameters:
value - the crc
Throws:
IllegalArgumentException - if value is < 0 or > 0xFFFFFFFFL

setExtra

public void setExtra(byte[] data)
Sets the extra information for this ZipEntry.

Parameters:
data - a byte array containing the extra information
Throws:
IllegalArgumentException - when the length of data is > 0xFFFF bytes

setMethod

public void setMethod(int value)
Sets the compression method for this ZipEntry.

Parameters:
value - the compression method, either DEFLATED or STORED
Throws:
IllegalArgumentException - when value is not DEFLATED or STORED

setSize

public void setSize(long value)
Sets the uncompressed size of this ZipEntry.

Parameters:
value - the uncompressed size
Throws:
IllegalArgumentException - if value is < 0 or > 0xFFFFFFFFL

setTime

public void setTime(long value)
Sets the last modification time of this ZipEntry.

Parameters:
value - the last modification time as the number of milliseconds since Jan. 1, 1970

toString

public String toString()
Returns the string representation of this ZipEntry.

Overrides:
toString in class Object
Returns:
the string representation of this ZipEntry

clone

public Object clone()
Returns a shallow copy of this entry

Overrides:
clone in class Object
Returns:
a copy of this entry

hashCode

public int hashCode()
Returns the hashCode for this ZipEntry.

Overrides:
hashCode in class Object
Returns:
the hashCode of the entry
See Also:
Object.equals(java.lang.Object)

setVersionToExtract

void setVersionToExtract(int version)

getGPBitFlag

int getGPBitFlag()

setGPBitFlag

void setGPBitFlag(int flags)

getLocalHeaderRelOffset

long getLocalHeaderRelOffset()

setLocalHeaderRelOffset

void setLocalHeaderRelOffset(long offset)

setDateTime

void setDateTime(int lastModFileDate,
                 int lastModFileTime)

readShortLE

static int readShortLE(RandomAccessFile raf)
                throws IOException
Throws:
IOException

readIntLE

static long readIntLE(RandomAccessFile raf)
               throws IOException
Throws:
IOException

writeShortLE

static void writeShortLE(OutputStream out,
                         int val)
                  throws IOException
Throws:
IOException

writeIntLE

static void writeIntLE(OutputStream out,
                       long val)
                throws IOException
Throws:
IOException

writeLFH

int writeLFH(OutputStream out)
       throws IOException
Throws:
IOException

writeDD

int writeDD(OutputStream out)
      throws IOException
Throws:
IOException

writeCDE

int writeCDE(OutputStream out)
       throws IOException
Throws:
IOException

Build 1.0_r1(from source)

Please submit a feedback, bug or feature