本文整理了Java中java.util.zip.ZipEntry.getComment()
方法的一些代码示例,展示了ZipEntry.getComment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipEntry.getComment()
方法的具体详情如下:
包路径:java.util.zip.ZipEntry
类名称:ZipEntry
方法名:getComment
[英]Returns the comment for this ZipEntry, or null if there is no comment. If we're reading a zip file using ZipInputStream, the comment is not available.
[中]返回此ZipEntry的注释,如果没有注释,则返回null。如果我们正在使用ZipInputStream读取zip文件,则评论不可用。
代码示例来源:origin: Blankj/AndroidUtilCode
/**
* Return the files' comment in ZIP file.
*
* @param zipFile The ZIP file.
* @return the files' comment in ZIP file
* @throws IOException if an I/O error has occurred
*/
public static List<String> getComments(final File zipFile)
throws IOException {
if (zipFile == null) return null;
List<String> comments = new ArrayList<>();
ZipFile zip = new ZipFile(zipFile);
Enumeration<?> entries = zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = ((ZipEntry) entries.nextElement());
comments.add(entry.getComment());
}
zip.close();
return comments;
}
代码示例来源: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: google/j2objc
outEntry.setComment(entry.getComment());
outEntry.setSize(bytes.length);
代码示例来源:origin: org.easymock/easymock
outEntry.setComment(entry.getComment());
outEntry.setSize(bytes.length);
代码示例来源:origin: cglib/cglib
outEntry.setComment(entry.getComment());
outEntry.setSize(bytes.length);
代码示例来源:origin: cglib/cglib
outEntry.setComment(entry.getComment());
outEntry.setSize(bytes.length);
代码示例来源:origin: org.apache.ant/ant
outputEntry.setComment(inputEntry.getComment());
outputEntry.setTime(inputEntry.getTime());
if (compression) {
代码示例来源: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: jphp-group/jphp
private static ArrayMemory zipEntryToArray(ZipEntry zipEntry) {
final ArrayMemory result = new ArrayMemory();
result.refOfIndex("name").assign(zipEntry.getName());
result.refOfIndex("crc").assign(zipEntry.getCrc());
result.refOfIndex("size").assign(zipEntry.getSize());
result.refOfIndex("compressedSize").assign(zipEntry.getCompressedSize());
result.refOfIndex("time").assign(zipEntry.getTime());
result.refOfIndex("method").assign(zipEntry.getMethod());
result.refOfIndex("comment").assign(zipEntry.getComment());
result.refOfIndex("directory").assign(zipEntry.isDirectory());
return result;
}
代码示例来源:origin: robovm/robovm
String comment = currentEntry.getComment();
byte[] commentBytes = EmptyArray.BYTE;
if (comment != null) {
代码示例来源:origin: SeanDragon/protools
/**
* 获取压缩文件中的注释链表
*
* @param zipFile
* 压缩文件
*
* @return 压缩文件中的注释链表
*
* @throws IOException
* IO错误时抛出
*/
public static List<String> getComments(File zipFile)
throws IOException {
if (zipFile == null) {
return null;
}
List<String> comments = Lists.newArrayList();
Enumeration<?> entries = getEntries(zipFile);
while (entries.hasMoreElements()) {
ZipEntry entry = ((ZipEntry) entries.nextElement());
comments.add(entry.getComment());
}
return comments;
}
代码示例来源:origin: huangweicai/OkLibDemo
/**
* 取得压缩文件对象的注释
*
* @param entry
* 压缩文件对象
* @return 压缩文件对象的注释
* @throws UnsupportedEncodingException
*/
public static String getEntryComment(ZipEntry entry)
throws UnsupportedEncodingException {
return new String(entry.getComment().getBytes("GB2312"), "8859_1");
}
代码示例来源:origin: it.unimi.dsi/mg4j
public InputStream stream( final int index ) throws IOException {
final ZipEntry entry = getEntry ( index );
entry.getComment(); // Just skip title
InputStream is = zipFile.getInputStream( entry );
return is;
}
代码示例来源:origin: it.unimi.dsi/mg4j-big
public InputStream stream( final long index ) throws IOException {
ensureDocumentIndex( index );
final ZipEntry entry = getEntry ( (int)index );
entry.getComment(); // Just skip title
InputStream is = zipFile.getInputStream( entry );
return is;
}
代码示例来源:origin: BaseXdb/basex
@Override
public void write(final ArchiveIn in) throws IOException {
final ZipEntry zi = in.entry();
final ZipEntry zo = new ZipEntry(zi.getName());
zo.setTime(zi.getTime());
zo.setComment(zi.getComment());
zos.putNextEntry(zo);
for(int c; (c = in.read(data)) != -1;) zos.write(data, 0, c);
zos.closeEntry();
}
代码示例来源:origin: org.basex/basex
@Override
public void write(final ArchiveIn in) throws IOException {
final ZipEntry zi = in.entry();
final ZipEntry zo = new ZipEntry(zi.getName());
zo.setTime(zi.getTime());
zo.setComment(zi.getComment());
zos.putNextEntry(zo);
for(int c; (c = in.read(data)) != -1;) zos.write(data, 0, c);
zos.closeEntry();
}
代码示例来源: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: it.unimi.di/mg4j
private Reference2ObjectMap<Enum<?>,Object> metadata( final int index, ZipEntry entry ) {
if ( entry == null ) entry = getEntry( index );
final Reference2ObjectArrayMap<Enum<?>,Object> metadata = new Reference2ObjectArrayMap<Enum<?>,Object>( 1 );
metadata.put( MetadataKeys.TITLE, entry.getComment() );
return metadata;
}
代码示例来源:origin: it.unimi.dsi/mg4j-big
private Reference2ObjectMap<Enum<?>,Object> metadata( final long index, ZipEntry entry ) {
ensureDocumentIndex( index );
if ( entry == null ) entry = getEntry( (int)index );
final Reference2ObjectArrayMap<Enum<?>,Object> metadata = new Reference2ObjectArrayMap<Enum<?>,Object>( 1 );
metadata.put( MetadataKeys.TITLE, entry.getComment() );
return metadata;
}
代码示例来源:origin: it.unimi.di/mg4j-big
private Reference2ObjectMap<Enum<?>,Object> metadata( final long index, ZipEntry entry ) {
ensureDocumentIndex( index );
if ( entry == null ) entry = getEntry( (int)index );
final Reference2ObjectArrayMap<Enum<?>,Object> metadata = new Reference2ObjectArrayMap<Enum<?>,Object>( 1 );
metadata.put( MetadataKeys.TITLE, entry.getComment() );
return metadata;
}
内容来源于网络,如有侵权,请联系作者删除!