Package org.zeroturnaround.zip
Class ZipEntryUtil
java.lang.Object
org.zeroturnaround.zip.ZipEntryUtil
Util class for static methods shared between ZipUtil and Zips.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
addEntry
(ZipEntry zipEntry, InputStream in, ZipOutputStream out) Adds a given ZIP entry to a ZIP file.(package private) static ZipEntry
Copy entry(package private) static ZipEntry
Copy entry with another name.(package private) static void
copyEntry
(ZipEntry zipEntry, InputStream in, ZipOutputStream out) Copies a given ZIP entry to a ZIP file.(package private) static void
copyEntry
(ZipEntry originalEntry, InputStream in, ZipOutputStream out, boolean preserveTimestamps) Copies a given ZIP entry to a ZIP file.(package private) static ZipEntry
Create new Zip entry and fill it with associated with file meta-infoprivate static AsiExtraField
getFirstAsiExtraField
(List<ZipExtraField> fields) (package private) static ZTFilePermissions
getZTFilePermissions
(ZipEntry zipEntry) Get assigned to ZIP entry file permissions info.(package private) static boolean
setZTFilePermissions
(ZipEntry zipEntry, ZTFilePermissions permissions) Add file permissions info to ZIP entry.
-
Constructor Details
-
ZipEntryUtil
private ZipEntryUtil()
-
-
Method Details
-
copy
Copy entry- Parameters:
original
- - zipEntry to copy- Returns:
- copy of the original entry
-
copy
Copy entry with another name.- Parameters:
original
- - zipEntry to copynewName
- - new entry name, optional, if null, ogirinal's entry- Returns:
- copy of the original entry, but with the given name
-
copyEntry
Copies a given ZIP entry to a ZIP file.- Parameters:
zipEntry
- a ZIP entry from existing ZIP file.in
- contents of the ZIP entry.out
- target ZIP stream.- Throws:
IOException
-
copyEntry
static void copyEntry(ZipEntry originalEntry, InputStream in, ZipOutputStream out, boolean preserveTimestamps) throws IOException Copies a given ZIP entry to a ZIP file. If this.preserveTimestamps is true, original timestamp is carried over, otherwise uses current time.- Parameters:
originalEntry
- a ZIP entry from existing ZIP file.in
- contents of the ZIP entry.out
- target ZIP stream.- Throws:
IOException
-
addEntry
Adds a given ZIP entry to a ZIP file.- Parameters:
zipEntry
- new ZIP entry.in
- contents of the ZIP entry.out
- target ZIP stream.- Throws:
IOException
-
fromFile
Create new Zip entry and fill it with associated with file meta-info- Parameters:
name
- Zip entry namefile
- source File- Returns:
- newly created Zip entry
-
setZTFilePermissions
Add file permissions info to ZIP entry. Current implementation adds "ASi Unix" (tag 0x756e) extra block to entry.- Parameters:
zipEntry
- ZIP entrypermissions
- permissions to assign
-
getZTFilePermissions
Get assigned to ZIP entry file permissions info. Current implementation tries to read "ASi Unix" (tag 0x756e) extra tag. "ASi Unix"- Parameters:
zipEntry
-- Returns:
- file permissions info or
null
if ZIP entry does not have "ASi Unix" extra field.
-
getFirstAsiExtraField
-