當前位置: 首頁>>代碼示例>>Java>>正文


Java JarFile.MANIFEST_NAME屬性代碼示例

本文整理匯總了Java中java.util.jar.JarFile.MANIFEST_NAME屬性的典型用法代碼示例。如果您正苦於以下問題:Java JarFile.MANIFEST_NAME屬性的具體用法?Java JarFile.MANIFEST_NAME怎麽用?Java JarFile.MANIFEST_NAME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.jar.JarFile的用法示例。


在下文中一共展示了JarFile.MANIFEST_NAME屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: jarDir

public static void jarDir(File dir, String relativePath, ZipOutputStream zos)
  throws IOException {
  Preconditions.checkNotNull(relativePath, "relativePath");
  Preconditions.checkNotNull(zos, "zos");

  // by JAR spec, if there is a manifest, it must be the first entry in the
  // ZIP.
  File manifestFile = new File(dir, JarFile.MANIFEST_NAME);
  ZipEntry manifestEntry = new ZipEntry(JarFile.MANIFEST_NAME);
  if (!manifestFile.exists()) {
    zos.putNextEntry(manifestEntry);
    new Manifest().write(new BufferedOutputStream(zos));
    zos.closeEntry();
  } else {
    copyToZipStream(manifestFile, manifestEntry, zos);
  }
  zos.closeEntry();
  zipDir(dir, relativePath, zos, true);
  zos.close();
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:20,代碼來源:JarFinder.java

示例2: copyJarFile

static void copyJarFile(JarInputStream in, JarOutputStream out) throws IOException {
    if (in.getManifest() != null) {
        ZipEntry me = new ZipEntry(JarFile.MANIFEST_NAME);
        out.putNextEntry(me);
        in.getManifest().write(out);
        out.closeEntry();
    }
    byte[] buffer = new byte[1 << 14];
    for (JarEntry je; (je = in.getNextJarEntry()) != null; ) {
        out.putNextEntry(je);
        for (int nr; 0 < (nr = in.read(buffer)); ) {
            out.write(buffer, 0, nr);
        }
    }
    in.close();
    markJarFile(out);  // add PACK200 comment
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:Utils.java

示例3: verwerkManifest

private void verwerkManifest(final Path tmpFolder, final FileTime bestandstijd, final JarOutputStream nieuwArchiefStream) throws MojoExecutionException {
    final File archiefBestand = new File(tmpFolder.toFile(), JarFile.MANIFEST_NAME);
    getLog().debug("Processing manifest");
    if (archiefBestand.exists()) {
        try (final FileInputStream fis = new FileInputStream(archiefBestand)) {
            Manifest manifest = new Manifest();
            if (archiefBestand.exists()) {
                manifest.read(fis);
            }
            ZipEntry manifestFolder = new ZipEntry(META_INF_PATH);
            fixeerDatumTijd(manifestFolder, bestandstijd);
            nieuwArchiefStream.putNextEntry(manifestFolder);
            nieuwArchiefStream.closeEntry();
            ZipEntry manifestBestand = new ZipEntry(JarFile.MANIFEST_NAME);
            fixeerDatumTijd(manifestBestand, bestandstijd);
            nieuwArchiefStream.putNextEntry(manifestBestand);
            manifest.write(nieuwArchiefStream);
            nieuwArchiefStream.closeEntry();
            getLog().debug("manifest processed");
        } catch (IOException e) {
            throw new MojoExecutionException("Cannot write manifest file", e);
        }
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:24,代碼來源:TimestampMojo.java

示例4: isSharedFlyweight

private static boolean isSharedFlyweight(Object obj) {
    if (obj == null) {
        return true;
    }
    if (obj == Boolean.TRUE || obj == Boolean.FALSE) {
        return true;
    }
    if (/* obj == Locale.ROOT || *//* Java 6 */
    obj == Locale.ENGLISH || obj == Locale.FRENCH || obj == Locale.GERMAN || obj == Locale.ITALIAN
            || obj == Locale.JAPANESE || obj == Locale.KOREAN || obj == Locale.CHINESE
            || obj == Locale.SIMPLIFIED_CHINESE || obj == Locale.TRADITIONAL_CHINESE || obj == Locale.FRANCE
            || obj == Locale.GERMANY || obj == Locale.ITALY || obj == Locale.JAPAN || obj == Locale.KOREA
            || obj == Locale.CHINA || obj == Locale.PRC || obj == Locale.TAIWAN || obj == Locale.UK
            || obj == Locale.US || obj == Locale.CANADA || obj == Locale.CANADA_FRENCH) {
        return true;
    }
    if (obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP) {
        return true;
    }
    if (obj == BigInteger.ZERO || obj == BigInteger.ONE) {
        return true;
    }
    if (obj == System.in || obj == System.out || obj == System.err) {
        return true;
    }
    if (obj == String.CASE_INSENSITIVE_ORDER) {
        return true;
    }
    if (obj == JarFile.MANIFEST_NAME) {
        return true;
    }
    return false;
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:33,代碼來源:ObjectProfiler.java

示例5: pakManifestUit

private void pakManifestUit(final Path tmpFolder, final JarInputStream archiefStream, final List<String> bestanden) throws IOException {
    final File manifestBestand = new File(tmpFolder.toFile(), JarFile.MANIFEST_NAME);
    final File manifestFolder = new File(manifestBestand.getAbsolutePath().substring(0, manifestBestand.getAbsolutePath().lastIndexOf(File.separator)));
    manifestFolder.mkdirs();
    if (manifestBestand.createNewFile()) {
        try (final FileOutputStream fos = new FileOutputStream(manifestBestand);
             final BufferedOutputStream bos = new BufferedOutputStream(fos)) {
            archiefStream.getManifest().write(bos);
        }
        bestanden.add(META_INF_PATH);
        bestanden.add(JarFile.MANIFEST_NAME);
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:13,代碼來源:TimestampMojo.java

示例6: createJarFile

/**
 * Creates a JAR file.
 *
 * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
 *
 * The input files are resolved against the given directory. Any input
 * files that are directories are processed recursively.
 */
static void createJarFile(Path jarfile, Manifest man, Path dir, String... files)
    throws IOException
{
    // create the target directory
    Path parent = jarfile.getParent();
    if (parent != null)
        Files.createDirectories(parent);

    List<Path> entries = new ArrayList<>();
    for (String file : files) {
        Files.find(dir.resolve(file), Integer.MAX_VALUE,
                (p, attrs) -> attrs.isRegularFile())
                .map(e -> dir.relativize(e))
                .forEach(entries::add);
    }

    try (OutputStream out = Files.newOutputStream(jarfile);
         JarOutputStream jos = new JarOutputStream(out))
    {
        if (man != null) {
            JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
            jos.putNextEntry(je);
            man.write(jos);
            jos.closeEntry();
        }

        for (Path entry : entries) {
            String name = toJarEntryName(entry);
            jos.putNextEntry(new JarEntry(name));
            Files.copy(dir.resolve(entry), jos);
            jos.closeEntry();
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:Main.java


注:本文中的java.util.jar.JarFile.MANIFEST_NAME屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。