ewe.zip
Class ZipEntry

java.lang.Object
  extended byewe.data.DataObject
      extended byewe.data.LiveObject
          extended byewe.data.LiveTreeNode
              extended byewe.zip.ZipEntry
All Implemented Interfaces:
Comparable, Copyable, DataUnit, FieldListener, LiveData, MutableTreeNode, TreeNode
Direct Known Subclasses:
ZipEntry

public class ZipEntry
extends LiveTreeNode

This class represents a member of a zip archive. ZipFile and ZipInputStream will give you instances of this class as information about the members in an archive. On the other hand ZipOutputStream needs an instance of this class to create a new member.


Field Summary
static int DEFLATED
          Compression method.
 SubString myFileName
           
static int STORED
          Compression method.
 
Fields inherited from class ewe.data.LiveTreeNode
children, parent
 
Constructor Summary
ZipEntry(String name)
          Creates a zip entry with the given name.
ZipEntry(ZipEntry e)
          Creates a copy of the given zip entry.
 
Method Summary
 int compareTo(Object other)
          Compare this object with another.
 String getComment()
          Gets the comment.
 int getCompressedSize()
          Gets the size of the compressed data.
 long getCrc()
          Gets the crc of the uncompressed data.
 byte[] getExtra()
          Gets the extra data.
 int getMethod()
          Gets the compression method.
 String getName()
          Returns the entry name.
 int getSize()
          Gets the size of the uncompressed data.
 Time getTime(Time t)
          Gets the time of last modification of the entry.
 boolean isDirectory()
          Gets true, if the entry is a directory.
 void setComment(String comment)
          Sets the entry comment.
 void setCompressedSize(int csize)
          Sets the size of the compressed data.
 void setCrc(int crc)
          Sets the crc of the uncompressed data.
 void setExtra(byte[] extra)
          Sets the extra data.
 boolean setMethod(int method)
          Sets the compression method.
 void setSize(int size)
          Sets the size of the uncompressed data.
 void setTime(Time t)
          Sets the time of last modification of the entry.
 String toString()
          Gets the string representation of this ZipEntry.
 
Methods inherited from class ewe.data.LiveTreeNode
addChild, addressOfChild, addressOfChild, addressOfChild, canExpand, collapse, expand, findNamedChild, getChild, getChildAt, getChildAt, getChildCount, getChildren, getParent, getParent, getSibling, indexOfChild, insertChild, isLeaf, isNamed, removeChild, setParent
 
Methods inherited from class ewe.data.LiveObject
action, action, addMeToPanel, addObjectToPanel, addToPanel, decode, decoded, decodeFields, enableEditorScrolling, encode, encoded, encodeFields, fieldChanged, fieldChanged, fieldEvent, getEditor, getEditorScroller, getIcon, input, makeNewEditor, runAsApp, textDecode, textEncode
 
Methods inherited from class ewe.data.DataObject
_getSetField, appendAllFields, copied, copyFrom, equals, getCopy, getDeclaredField, getDeclaredFieldValue, getDeclaredFieldValue, getFieldList, getFieldList, getMyFieldList, getNew
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode
 
Methods inherited from interface ewe.data.DataUnit
copyFrom, getNew
 
Methods inherited from interface ewe.util.Copyable
getCopy
 

Field Detail

STORED

public static final int STORED
Compression method. This method doesn't compress at all.

See Also:
Constant Field Values

DEFLATED

public static final int DEFLATED
Compression method. This method uses the Deflater.

See Also:
Constant Field Values

myFileName

public SubString myFileName
Constructor Detail

ZipEntry

public ZipEntry(String name)
Creates a zip entry with the given name.

Parameters:
name - the name. May include directory components separated by '/'.

ZipEntry

public ZipEntry(ZipEntry e)
Creates a copy of the given zip entry.

Parameters:
e - the entry to copy.
Method Detail

getName

public String getName()
Returns the entry name. The path components in the entry are always separated by slashes ('/').

Specified by:
getName in interface LiveData
Overrides:
getName in class LiveObject

setTime

public void setTime(Time t)
Sets the time of last modification of the entry.


getTime

public Time getTime(Time t)
Gets the time of last modification of the entry.

Returns:
the time of last modification of the entry, or -1 if unknown.

setSize

public void setSize(int size)
Sets the size of the uncompressed data.

Throws:
IllegalArgumentException - if size is not in 0..0xffffffffL

getSize

public int getSize()
Gets the size of the uncompressed data.

Returns:
the size or -1 if unknown.

setCompressedSize

public void setCompressedSize(int csize)
Sets the size of the compressed data.

Throws:
IllegalArgumentException - if size is not in 0..0xffffffffL

getCompressedSize

public int getCompressedSize()
Gets the size of the compressed data.

Returns:
the size or -1 if unknown.

setCrc

public void setCrc(int crc)
Sets the crc of the uncompressed data.

Throws:
IllegalArgumentException - if crc is not in 0..0xffffffffL

getCrc

public long getCrc()
Gets the crc of the uncompressed data.

Returns:
the crc (lower 32 bits) or -1 if unknown.

setMethod

public boolean setMethod(int method)
Sets the compression method. Only DEFLATED and STORED are supported.

Throws:
IllegalArgumentException - if method is not supported.
See Also:
ZipOutputStream.DEFLATED, ZipOutputStream.STORED

getMethod

public int getMethod()
Gets the compression method.

Returns:
the compression method or -1 if unknown.

setExtra

public void setExtra(byte[] extra)
Sets the extra data.


getExtra

public byte[] getExtra()
Gets the extra data.

Returns:
the extra data or null if not set.

setComment

public void setComment(String comment)
Sets the entry comment.

Throws:
IllegalArgumentException - if comment is longer than 0xffff.

getComment

public String getComment()
Gets the comment.

Returns:
the comment or null if not set.

isDirectory

public boolean isDirectory()
Gets true, if the entry is a directory. This is solely determined by the name, a trailing slash '/' marks a directory.


toString

public String toString()
Gets the string representation of this ZipEntry. This is just the name as returned by getName().

Overrides:
toString in class Object
Returns:
a String representing this object.

compareTo

public int compareTo(Object other)
Description copied from interface: Comparable
Compare this object with another. It should return: less than 0 if this object is considered LESS than the "other" object; greater than 0 if this object is considered GREATER than the "other" object; 0 if this object is considered EQUAL to the "other" object. (i.e. it is an implicit subtraction).

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class DataObject