지정된 ZipEntry 개체에서 가져온 필드를 사용하여 새 JarEntry를 만듭니다. 행동 양식:
속성 getAttributes() :
Returns the Manifest Attributes for this entry or null if none.
Syntax : public Attributes getAttributes() throws IOException Returns: the Manifest Attributes for this entry or null if none
인증서[] getCertificates() :
Returns the Certificate objects for this entry or null if none.
Syntax : public Certificate[] getCertificates() Returns: the Certificate objects for this entry or null if none.
CodeSigner[] getCodeSigners() :
Returns the CodeSigner objects for this entry or null if none.
Syntax : public CodeSigner[] getCodeSigners() Returns: the CodeSigner objects for this entry or null if none.
java.util.zip.ZipEntry 클래스에서 상속된 메소드 복제 getComment getCompressedSize getCrc getExtra getMethod getName getSize getTime hashCode isDirectory setComment setCompressedSize setCrc setExtra setMethod setSize setTime toString java.lang.Object 클래스에서 상속된 메소드 같음 finalize getClass 통지 informAll 대기 대기 대기 참고: 프로그램은 파일을 읽을 수 없으므로 온라인 IDE에서 실행되지 않습니다. 프로그램 1: Java
//Java program demonstrating JarEntry methodimportjava.io.FileInputStream;importjava.io.IOException;importjava.io.PrintStream;importjava.util.jar.JarEntry;importjava.util.jar.JarInputStream;classJarEntryDemo{publicstaticvoidmain(String[]args)throwsIOException{FileInputStreamfis=newFileInputStream('codechecker.jar');JarInputStreamjis=newJarInputStream(fis);JarEntryje=jis.getNextJarEntry();PrintStreamout=System.out;//illustrating getAttributesout.println(je.getAttributes());//illustrating getCodeSignerout.println(je.getCodeSigners());//illustrating getCertificatesout.println(je.getCertificates());}}
프로그램 2: Java
//Java program demonstrating JarEntry methodpackagejava.util.jar;importjava.io.IOException;importjava.util.zip.ZipEntry;importjava.security.CodeSigner;importjava.security.cert.Certificate;publicclassJarEntryextendsZipEntry{Attributesattr;Certificate[]certs;CodeSigner[]signers;publicJarEntry(Stringname){super(name);}publicJarEntry(ZipEntryze){super(ze);}publicJarEntry(JarEntryje){this((ZipEntry)je);this.attr=je.attr;this.certs=je.certs;this.signers=je.signers;}publicAttributesgetAttributes()throwsIOException{returnattr;}publicCertificate[]getCertificates(){returncerts==null?null:(Certificate[])certs.clone();}publicCodeSigner[]getCodeSigners(){returnsigners==null?null:(CodeSigner[])signers.clone();}}