/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. * * @since 1.1 */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields(true))); }
/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. * * @since 1.1 */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields(true))); }
/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getAllExtraFieldsNoCopy())); }
public ZipEntry newZipEntry(ZipEntry ze) { ZipEntry ze2 = new ZipEntry(ze.getName()); ze2.setComment(ze.getComment()); ze2.setTime(ze.getTime()); ze2.setExtra(ze.getExtra()); return ze2; }
outputEntry.setExtra(inputEntry.getExtra()); outputEntry.setComment(inputEntry.getComment()); outputEntry.setTime(inputEntry.getTime());
/** * Copy entry with another name. * * @param original - zipEntry to copy * @param newName - new entry name, optional, if null, ogirinal's entry * @return copy of the original entry, but with the given name */ static ZipEntry copy(ZipEntry original, String newName) { ZipEntry copy = new ZipEntry(newName == null ? original.getName() : newName); if (original.getCrc() != -1) { copy.setCrc(original.getCrc()); } if (original.getMethod() != -1) { copy.setMethod(original.getMethod()); } if (original.getSize() >= 0) { copy.setSize(original.getSize()); } if (original.getExtra() != null) { copy.setExtra(original.getExtra()); } copy.setComment(original.getComment()); copy.setTime(original.getTime()); return copy; }
/** * Add file permissions info to ZIP entry. * Current implementation adds "ASi Unix" (tag 0x756e) extra block to entry. * * @param zipEntry ZIP entry * @param permissions permissions to assign */ static boolean setZTFilePermissions(ZipEntry zipEntry, ZTFilePermissions permissions) { try { List<ZipExtraField> fields = ExtraFieldUtils.parse(zipEntry.getExtra()); AsiExtraField asiExtraField = getFirstAsiExtraField(fields); if (asiExtraField == null) { asiExtraField = new AsiExtraField(); fields.add(asiExtraField); } asiExtraField.setDirectory(zipEntry.isDirectory()); asiExtraField.setMode(ZTFilePermissionsUtil.toPosixFileMode(permissions)); zipEntry.setExtra(ExtraFieldUtils.mergeLocalFileDataData(fields)); return true; } catch (java.util.zip.ZipException ze) { return false; } }
byte[] extraData = new byte[extraLength]; Streams.readFully(in, extraData, 0, extraLength); currentEntry.setExtra(extraData);
public void addMimeTypeFile(String statedPath, String actualPath) throws IOException { // byte data[] = new byte[BUFFER]; CRC32 crc = new CRC32(); // FileInputStream fi = new FileInputStream(actualPath); // BufferedInputStream origin = new BufferedInputStream(fi, BUFFER); out.setLevel(0); ZipEntry entry = new ZipEntry(statedPath); entry.setExtra(null); names.add(statedPath); String contents = "application/epub+zip"; crc.update(contents.getBytes()); entry.setCompressedSize(contents.length()); entry.setSize(contents.length()); entry.setCrc(crc.getValue()); entry.setMethod(ZipEntry.STORED); out.putNextEntry(entry); // int count; // while ((count = origin.read(data, 0, BUFFER)) != -1) { // out.write(data, 0, count); // } // origin.close(); out.write(contents.getBytes(),0,contents.length()); out.setLevel(Deflater.BEST_COMPRESSION); }
/** * @return entry */ public ZipEntry getZipEntry() { ZipEntry entry = new ZipEntry(name); entry.setComment(comment); entry.setExtra(extraFieldData); return entry; }
public void setExtra(@Nullable byte[] extra) { getHandle().setExtra(extra); }
private void prepareEntry(final Payload.Part part, final ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(part.getName()); entry.setExtra(getExtraBytes(part)); zos.putNextEntry(entry); }
private ZipEntry createEntry(FileInfo info) { ZipEntry entry = new ZipEntry(info.getUri()); entry.setExtra(info.toBytes()); return entry; }
/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields(true))); }
/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getAllExtraFieldsNoCopy())); }
/** * Unfortunately {@link java.util.zip.ZipOutputStream * java.util.zip.ZipOutputStream} seems to access the extra data * directly, so overriding getExtra doesn't help - we need to * modify super's data directly. */ protected void setExtra() { super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getAllExtraFieldsNoCopy())); }
public ZipEntry newZipEntry(ZipEntry ze) { ZipEntry ze2 = new ZipEntry(ze.getName()); ze2.setComment(ze.getComment()); ze2.setTime(ze.getTime()); ze2.setExtra(ze.getExtra()); return ze2; }
private void prepareEntry(final Payload.Part part, final ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(part.getName()); Extra extra = new Extra(part.getContentType(), part.getProperties()); entry.setExtra(extra.toBytes()); zos.putNextEntry(entry); }
private void prepareEntry(final Payload.Part part, final ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(part.getName()); Extra extra = new Extra(part.getContentType(), part.getProperties()); entry.setExtra(extra.toBytes()); zos.putNextEntry(entry); }
private void prepareEntry(final Payload.Part part, final ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(part.getName()); Extra extra = new Extra(part.getContentType(), part.getProperties()); entry.setExtra(extra.toBytes()); zos.putNextEntry(entry); }