logo

Java의 Java.util.jar.JarEntry 클래스

이 클래스는 JAR 파일 항목을 나타내는 데 사용됩니다. 생성자:
    JarEntry(JarEntry 먹기) :지정된 JarEntry 개체에서 가져온 필드를 사용하여 새 JarEntry를 만듭니다. JarEntry(문자열 이름) :지정된 JAR 파일 항목 이름에 대한 새 JarEntry를 만듭니다. JarEntry(ZipEntry 포함):지정된 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 method import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; class JarEntryDemo {  public static void main(String[] args) throws IOException   {  FileInputStream fis = new FileInputStream('codechecker.jar');  JarInputStream jis = new JarInputStream(fis);  JarEntry je=jis.getNextJarEntry();  PrintStream out = System.out;  //illustrating getAttributes  out.println(je.getAttributes());  //illustrating getCodeSigner  out.println(je.getCodeSigners());  //illustrating getCertificates  out.println(je.getCertificates());  } } 
프로그램 2: Java
//Java program demonstrating JarEntry method package java.util.jar;    import java.io.IOException;  import java.util.zip.ZipEntry;  import java.security.CodeSigner;  import java.security.cert.Certificate;  public class JarEntry extends ZipEntry  {  Attributes attr;  Certificate[] certs;  CodeSigner[] signers;    public JarEntry(String name)   {  super(name);  }    public JarEntry(ZipEntry ze)   {  super(ze);  }    public JarEntry(JarEntry je)  {  this((ZipEntry)je);  this.attr = je.attr;  this.certs = je.certs;  this.signers = je.signers;  }    public Attributes getAttributes() throws IOException   {  return attr;  }    public Certificate[] getCertificates()   {  return certs == null ? null : (Certificate[]) certs.clone();  }    public CodeSigner[] getCodeSigners()     {  return signers == null ? null : (CodeSigner[]) signers.clone();  } } 
퀴즈 만들기