当前位置: 首页>>代码示例>>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;未经允许,请勿转载。