本文整理了Java中java.util.zip.ZipEntry.setExtra()
方法的一些代码示例,展示了ZipEntry.setExtra()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipEntry.setExtra()
方法的具体详情如下:
包路径:java.util.zip.ZipEntry
类名称:ZipEntry
方法名:setExtra
[英]Sets the extra information for this ZipEntry.
[中]设置此ZipEntry的额外信息。
代码示例来源:origin: org.apache.ant/ant
/**
* 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)));
}
代码示例来源:origin: alibaba/mdrill
/**
* 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)));
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* 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()));
}
代码示例来源:origin: spotbugs/spotbugs
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;
}
代码示例来源:origin: org.apache.ant/ant
outputEntry.setExtra(inputEntry.getExtra());
outputEntry.setComment(inputEntry.getComment());
outputEntry.setTime(inputEntry.getTime());
代码示例来源:origin: zeroturnaround/zt-zip
/**
* 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;
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* 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;
}
}
代码示例来源:origin: robovm/robovm
byte[] extraData = new byte[extraLength];
Streams.readFully(in, extraData, 0, extraLength);
currentEntry.setExtra(extraData);
代码示例来源:origin: jamesagnew/hapi-fhir
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);
}
代码示例来源:origin: open-eid/digidoc4j
/**
* @return entry
*/
public ZipEntry getZipEntry() {
ZipEntry entry = new ZipEntry(name);
entry.setComment(comment);
entry.setExtra(extraFieldData);
return entry;
}
代码示例来源:origin: com.github.bloodshura/ignitium-core
public void setExtra(@Nullable byte[] extra) {
getHandle().setExtra(extra);
}
代码示例来源:origin: org.glassfish.main.core/kernel
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);
}
代码示例来源:origin: asakusafw/asakusafw
private ZipEntry createEntry(FileInfo info) {
ZipEntry entry = new ZipEntry(info.getUri());
entry.setExtra(info.toBytes());
return entry;
}
代码示例来源:origin: org.xbib/archive
/**
* 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)));
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* 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()));
}
代码示例来源:origin: KostyaSha/yet-another-docker-plugin
/**
* 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()));
}
代码示例来源:origin: com.google.code.findbugs/findbugs
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;
}
代码示例来源:origin: org.glassfish.main.common/common-util
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);
}
代码示例来源:origin: org.glassfish.common/common-util
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);
}
代码示例来源:origin: eclipse-ee4j/glassfish
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);
}
内容来源于网络,如有侵权,请联系作者删除!