logo

Java の Java.util.jar.JarEntry クラス

このクラスは、JAR ファイル エントリを表すために使用されます。 コンストラクター:
    JarEntry(JarEntry Eat) :指定された 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 から継承されたメソッド clone getComment getCompressedSize getCrc getExtra getMethod getName getSize getTime hashCode isDirectory setComment setCompressedSize setCrc setExtra setMethod setSize setTime toString クラス java.lang.Object から継承されたメソッド 等しい ファイナライズ getClass 通知 通知すべて 待機 待機 待機 注: ファイルを読み取ることができないため、プログラムはオンライン 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();  } } 
クイズの作成