下面列出了java.util.zip.ZipEntry#getComment ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public ZipContentLocation( ZipRepository repository, ZipContentLocation parent, ZipEntry zipEntry ) {
if ( repository == null ) {
throw new NullPointerException();
}
if ( parent == null ) {
throw new NullPointerException();
}
if ( zipEntry == null ) {
throw new NullPointerException();
}
this.repository = repository;
this.parent = parent;
this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() );
this.comment = zipEntry.getComment();
this.size = zipEntry.getSize();
this.time = zipEntry.getTime();
this.entries = new HashMap();
this.name = RepositoryUtilities.buildName( this, "/" ) + '/';
}
public ZipReadContentLocation( ZipReadRepository repository, ZipReadContentLocation parent, ZipEntry zipEntry ) {
if ( repository == null ) {
throw new NullPointerException();
}
if ( parent == null ) {
throw new NullPointerException();
}
if ( zipEntry == null ) {
throw new NullPointerException();
}
this.repository = repository;
this.parent = parent;
this.comment = zipEntry.getComment();
this.size = zipEntry.getSize();
this.time = zipEntry.getTime();
this.entries = new HashMap();
this.entryName = IOUtils.getInstance().getFileName( zipEntry.getName() );
this.name = RepositoryUtilities.buildName( this, "/" ) + '/';
}
public ZipReadContentItem( final ZipReadRepository repository,
final ZipReadContentLocation parent,
final ZipEntry zipEntry,
final byte[] bytes ) {
if ( repository == null ) {
throw new NullPointerException();
}
if ( zipEntry == null ) {
throw new NullPointerException();
}
if ( bytes == null ) {
throw new NullPointerException();
}
this.parent = parent;
this.repository = repository;
this.comment = zipEntry.getComment();
this.name = zipEntry.getName();
this.entryName = IOUtils.getInstance().getFileName( name );
this.size = zipEntry.getSize();
this.time = zipEntry.getTime();
this.rawData = bytes;
}
private String zipEntryDebugString(ZipEntry entryOne) {
return "<ZE name="
+ entryOne.getName()
+ " crc="
+ entryOne.getCrc()
+ " comment="
+ entryOne.getComment()
+ " size="
+ entryOne.getSize()
+ " atime="
+ entryOne.getLastAccessTime()
+ " mtime="
+ entryOne.getLastModifiedTime()
+ " ctime="
+ entryOne.getCreationTime()
+ ">";
}
private String zipEntryDebugString(ZipEntry entryOne) {
return "<ZE name="
+ entryOne.getName()
+ " crc="
+ entryOne.getCrc()
+ " comment="
+ entryOne.getComment()
+ " size="
+ entryOne.getSize()
+ " atime="
+ entryOne.getLastAccessTime()
+ " mtime="
+ entryOne.getLastModifiedTime()
+ " ctime="
+ entryOne.getCreationTime();
}
/**
* 取得压缩文件对象的注释
*
* @param entry 压缩文件对象
* @return 压缩文件对象的注释
*/
public static String getEntryComment(ZipEntry entry) {
String result = "";
try {
result = entry.getComment();
if(null != result) {
result = new String(result.getBytes("GB2312"), "8859_1");
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public ZippedEntry(ZipEntry e, InputStream is) {
this.name = e.getName();
this.time = e.getTime();
// this.mtime = e.getLastModifiedTime();
// this.atime = e.getLastAccessTime();
// this.ctime = e.getCreationTime();
this.crc = e.getCrc();
this.size = e.getSize();
this.csize = e.getCompressedSize();
this.method = e.getMethod();
this.extra = e.getExtra();
this.comment = e.getComment();
this.is = is;
}
public ZippedEntry(ZipEntry e, InputStream is) {
this.name = e.getName();
this.time = e.getTime();
// this.mtime = e.getLastModifiedTime();
// this.atime = e.getLastAccessTime();
// this.ctime = e.getCreationTime();
this.crc = e.getCrc();
this.size = e.getSize();
this.csize = e.getCompressedSize();
this.method = e.getMethod();
this.extra = e.getExtra();
this.comment = e.getComment();
this.is = is;
}
public ZipContentItem( final ZipRepository repository,
final ZipContentLocation parent,
final ZipEntry zipEntry,
final byte[] bytes ) {
if ( repository == null ) {
throw new NullPointerException();
}
if ( zipEntry == null ) {
throw new NullPointerException();
}
if ( bytes == null ) {
throw new NullPointerException();
}
if ( parent == null ) {
throw new NullPointerException();
}
this.parent = parent;
this.repository = repository;
this.comment = zipEntry.getComment();
this.name = RepositoryUtilities.buildName( this, "/" );
this.entryName = IOUtils.getInstance().getFileName( name );
this.size = zipEntry.getSize();
this.crc32 = zipEntry.getCrc();
this.time = zipEntry.getTime();
this.rawData = bytes;
final int method = zipEntry.getMethod();
if ( method == ZipEntry.STORED || method == ZipEntry.DEFLATED ) {
this.method = new Integer( method );
} else {
this.method = new Integer( ZipEntry.DEFLATED );
}
this.compression = Deflater.DEFAULT_COMPRESSION;
}
private void updateMetaData( final ZipEntry zipEntry ) {
this.comment = zipEntry.getComment();
this.size = zipEntry.getSize();
this.time = zipEntry.getTime();
}
private void updateMetaData( final ZipEntry zipEntry ) {
this.comment = zipEntry.getComment();
this.size = zipEntry.getSize();
this.time = zipEntry.getTime();
}