Package com.intellij.util.io.zip
Class JBZipEntry
- java.lang.Object
-
- com.intellij.util.io.zip.JBZipEntry
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJBZipEntry(JBZipFile file)protectedJBZipEntry(String name, JBZipFile file)Creates a new zip entry with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderase()StringgetComment()Returns the comment string for the entry, or null if none.longgetCompressedSize()Returns the size of the compressed entry data, or -1 if not known.longgetCrc()Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.byte[]getData()longgetExternalAttributes()Retrieves the external file attributes.byte[]getExtra()Returns the extra field data for the entry, or null if none.longgetHeaderOffset()intgetInternalAttributes()Retrieves the internal file attributes.byte[]getLocalFileDataExtra()Retrieves the extra data for the local file data.intgetMethod()Returns the compression method of the entry, or -1 if not specified.StringgetName()Get the name of the entry.intgetPlatform()Platform specification to put into the "version made by" part of the central file header.longgetSize()Returns the uncompressed size of the entry data, or -1 if not known.longgetTime()Returns the modification time of the entry, or -1 if not specified.intgetUnixMode()Unix permission.inthashCode()Get the hashCode of the entry.booleanisDirectory()Is this entry a directory?voidsetComment(String comment)Sets the optional comment string for the entry.voidsetCompressedSize(long csize)Sets the size of the compressed entry data.voidsetCrc(long crc)Sets the CRC-32 checksum of the uncompressed entry data.voidsetData(byte[] bytes)voidsetData(byte[] bytes, long timestamp)voidsetExternalAttributes(long value)Sets the external file attributes.voidsetExtra(byte[] extra)Sets the optional extra field data for the entry.voidsetHeaderOffset(long headerOffset)voidsetInternalAttributes(int value)Sets the internal file attributes.voidsetMethod(int method)Sets the compression method for the entry.protected voidsetName(String name)Set the name of the entry.protected voidsetPlatform(int platform)Set the platform (UNIX or FAT).voidsetSize(long size)Sets the uncompressed size of the entry data.voidsetTime(long time)Sets the modification time of the entry.voidsetUnixMode(int mode)Sets Unix permissions in a way that is understood by Info-Zip's unzip command.
-
-
-
Method Detail
-
getInternalAttributes
public int getInternalAttributes()
Retrieves the internal file attributes.- Returns:
- the internal file attributes
- Since:
- 1.1
-
setInternalAttributes
public void setInternalAttributes(int value)
Sets the internal file attributes.- Parameters:
value- anintvalue- Since:
- 1.1
-
getExternalAttributes
public long getExternalAttributes()
Retrieves the external file attributes.- Returns:
- the external file attributes
- Since:
- 1.1
-
setExternalAttributes
public void setExternalAttributes(long value)
Sets the external file attributes.- Parameters:
value- anlongvalue- Since:
- 1.1
-
getHeaderOffset
public long getHeaderOffset()
-
setHeaderOffset
public void setHeaderOffset(long headerOffset)
-
setUnixMode
public void setUnixMode(int mode)
Sets Unix permissions in a way that is understood by Info-Zip's unzip command.- Parameters:
mode- anintvalue- Since:
- Ant 1.5.2
-
getUnixMode
public int getUnixMode()
Unix permission.- Returns:
- the unix permissions
- Since:
- Ant 1.6
-
getPlatform
public int getPlatform()
Platform specification to put into the "version made by" part of the central file header.- Returns:
- 0 (MS-DOS FAT) unless
setUnixModehas been called, in which case 3 (Unix) will be returned. - Since:
- Ant 1.5.2
-
setPlatform
protected void setPlatform(int platform)
Set the platform (UNIX or FAT).- Parameters:
platform- anintvalue - 0 is FAT, 3 is UNIX- Since:
- 1.9
-
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()
-
getLocalFileDataExtra
public byte[] getLocalFileDataExtra()
Retrieves the extra data for the local file data.- Returns:
- the extra data for local file
- Since:
- 1.1
-
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()
-
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)
-
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()
-
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)
-
getName
public String getName()
Get the name of the entry.- Returns:
- the entry name
- Since:
- 1.9
-
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
- See Also:
setCompressedSize(long)
-
setCompressedSize
public void setCompressedSize(long csize)
Sets the size of the compressed entry data.- Parameters:
csize- the compressed size to set to- See Also:
getCompressedSize()
-
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:
getCrc()
-
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:
setCrc(long)
-
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()
-
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
- See Also:
setMethod(int)
-
isDirectory
public boolean isDirectory()
Is this entry a directory?- Returns:
- true if the entry is a directory
- Since:
- 1.10
-
setName
protected void setName(String name)
Set the name of the entry.- Parameters:
name- the name to use
-
hashCode
public int hashCode()
Get the hashCode of the entry. This uses the name as the hashcode.
-
erase
public void erase() throws IOException- Throws:
IOException
-
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
- See Also:
setExtra(byte[])
-
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()
-
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
- See Also:
setComment(String)
-
setData
public void setData(byte[] bytes, long timestamp) throws IOException- Throws:
IOException
-
setData
public void setData(byte[] bytes) throws IOException- Throws:
IOException
-
getData
public byte[] getData() throws IOException- Throws:
IOException
-
-