Java 类sun.misc.JarIndex 实例源码

项目:OpenJSharp    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:OpenJSharp    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:jdk8u-jdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:jdk8u-jdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:jdk8u_jdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:jdk8u_jdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:lookaside_java-1.8.0-openjdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:infobip-open-jdk-8    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:infobip-open-jdk-8    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:jdk8u-dev-jdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:jdk8u-dev-jdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:jdk7-jdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:jdk7-jdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:openjdk-source-code-learn    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:openjdk-source-code-learn    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:OLD-OpenJDK8    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:OLD-OpenJDK8    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:openjdk-jdk7u-jdk    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:openjdk-jdk7u-jdk    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:openjdk-icedtea7    文件:Main.java   
/**
 * Outputs the class index table to the INDEX.LIST file of the
 * root jar file.
 */
void dumpIndex(String rootjar, JarIndex index) throws IOException {
    File jarFile = new File(rootjar);
    Path jarPath = jarFile.toPath();
    Path tmpPath = createTempFileInSameDirectoryAs(jarFile).toPath();
    try {
        if (update(Files.newInputStream(jarPath),
                   Files.newOutputStream(tmpPath),
                   null, index)) {
            try {
                Files.move(tmpPath, jarPath, REPLACE_EXISTING);
            } catch (IOException e) {
                throw new IOException(getMsg("error.write.file"), e);
            }
        }
    } finally {
        Files.deleteIfExists(tmpPath);
    }
}
项目:openjdk-icedtea7    文件:Main.java   
/**
 * Generates class index file for the specified root jar file.
 */
void genIndex(String rootjar, String[] files) throws IOException {
    List<String> jars = getJarPath(rootjar);
    int njars = jars.size();
    String[] jarfiles;

    if (njars == 1 && files != null) {
        // no class-path attribute defined in rootjar, will
        // use command line specified list of jars
        for (int i = 0; i < files.length; i++) {
            jars.addAll(getJarPath(files[i]));
        }
        njars = jars.size();
    }
    jarfiles = jars.toArray(new String[njars]);
    JarIndex index = new JarIndex(jarfiles);
    dumpIndex(rootjar, index);
}
项目:OpenJSharp    文件:JarInputStream.java   
/**
 * Reads the next ZIP file entry and positions the stream at the
 * beginning of the entry data. If verification has been enabled,
 * any invalid signature detected while positioning the stream for
 * the next entry will result in an exception.
 * @exception ZipException if a ZIP file error has occurred
 * @exception IOException if an I/O error has occurred
 * @exception SecurityException if any of the jar file entries
 *         are incorrectly signed.
 */
public ZipEntry getNextEntry() throws IOException {
    JarEntry e;
    if (first == null) {
        e = (JarEntry)super.getNextEntry();
        if (tryManifest) {
            e = checkManifest(e);
            tryManifest = false;
        }
    } else {
        e = first;
        if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
            tryManifest = true;
        first = null;
    }
    if (jv != null && e != null) {
        // At this point, we might have parsed all the meta-inf
        // entries and have nothing to verify. If we have
        // nothing to verify, get rid of the JarVerifier object.
        if (jv.nothingToVerify() == true) {
            jv = null;
            mev = null;
        } else {
            jv.beginEntry(e, mev);
        }
    }
    return e;
}
项目:OpenJSharp    文件:URLClassPath.java   
JarIndex getIndex() {
    try {
        ensureOpen();
    } catch (IOException e) {
        throw new InternalError(e);
    }
    return index;
}
项目:OpenJSharp    文件:Main.java   
private void addIndex(JarIndex index, ZipOutputStream zos)
    throws IOException
{
    ZipEntry e = new ZipEntry(INDEX_NAME);
    e.setTime(System.currentTimeMillis());
    if (flag0) {
        CRC32OutputStream os = new CRC32OutputStream();
        index.write(os);
        os.updateEntry(e);
    }
    zos.putNextEntry(e);
    index.write(zos);
    zos.closeEntry();
}
项目:jdk8u-jdk    文件:JarInputStream.java   
/**
 * Reads the next ZIP file entry and positions the stream at the
 * beginning of the entry data. If verification has been enabled,
 * any invalid signature detected while positioning the stream for
 * the next entry will result in an exception.
 * @exception ZipException if a ZIP file error has occurred
 * @exception IOException if an I/O error has occurred
 * @exception SecurityException if any of the jar file entries
 *         are incorrectly signed.
 */
public ZipEntry getNextEntry() throws IOException {
    JarEntry e;
    if (first == null) {
        e = (JarEntry)super.getNextEntry();
        if (tryManifest) {
            e = checkManifest(e);
            tryManifest = false;
        }
    } else {
        e = first;
        if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
            tryManifest = true;
        first = null;
    }
    if (jv != null && e != null) {
        // At this point, we might have parsed all the meta-inf
        // entries and have nothing to verify. If we have
        // nothing to verify, get rid of the JarVerifier object.
        if (jv.nothingToVerify() == true) {
            jv = null;
            mev = null;
        } else {
            jv.beginEntry(e, mev);
        }
    }
    return e;
}
项目:jdk8u-jdk    文件:URLClassPath.java   
JarIndex getIndex() {
    try {
        ensureOpen();
    } catch (IOException e) {
        throw new InternalError(e);
    }
    return index;
}
项目:jdk8u-jdk    文件:Main.java   
private void addIndex(JarIndex index, ZipOutputStream zos)
    throws IOException
{
    ZipEntry e = new ZipEntry(INDEX_NAME);
    e.setTime(System.currentTimeMillis());
    if (flag0) {
        CRC32OutputStream os = new CRC32OutputStream();
        index.write(os);
        os.updateEntry(e);
    }
    zos.putNextEntry(e);
    index.write(zos);
    zos.closeEntry();
}
项目:jdk8u-jdk    文件:JarIndexMergeTest.java   
public static void main(String[] args) throws Exception {
    File jar1 = buildJar1();
    File jar2 = buildJar2();

    JarIndex jarIndex1 = new JarIndex(new String[] { jar1.getAbsolutePath() });
    JarIndex jarIndex2 = new JarIndex(new String[] { jar2.getAbsolutePath() });

    jarIndex1.merge(jarIndex2, null);

    assertFileResolved(jarIndex2, "com/test1/resource1.file",
                       jar1.getAbsolutePath());
    assertFileResolved(jarIndex2, "com/test2/resource2.file",
                       jar2.getAbsolutePath());
}
项目:jdk8u-jdk    文件:JarIndexMergeTest.java   
static void assertFileResolved(JarIndex jarIndex2, String file,
                               String jarName) {
    @SuppressWarnings("unchecked")
    LinkedList<String> jarLists = (LinkedList<String>)jarIndex2.get(file);
    if (jarLists == null || jarLists.size() == 0 ||
        !jarName.equals(jarLists.get(0))) {
        throw new RuntimeException(
            "Unexpected result: the merged index must resolve file: "
            + file);
    }
}
项目:Java8CN    文件:JarInputStream.java   
/**
 * Reads the next ZIP file entry and positions the stream at the
 * beginning of the entry data. If verification has been enabled,
 * any invalid signature detected while positioning the stream for
 * the next entry will result in an exception.
 * @exception ZipException if a ZIP file error has occurred
 * @exception IOException if an I/O error has occurred
 * @exception SecurityException if any of the jar file entries
 *         are incorrectly signed.
 */
public ZipEntry getNextEntry() throws IOException {
    JarEntry e;
    if (first == null) {
        e = (JarEntry)super.getNextEntry();
        if (tryManifest) {
            e = checkManifest(e);
            tryManifest = false;
        }
    } else {
        e = first;
        if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
            tryManifest = true;
        first = null;
    }
    if (jv != null && e != null) {
        // At this point, we might have parsed all the meta-inf
        // entries and have nothing to verify. If we have
        // nothing to verify, get rid of the JarVerifier object.
        if (jv.nothingToVerify() == true) {
            jv = null;
            mev = null;
        } else {
            jv.beginEntry(e, mev);
        }
    }
    return e;
}
项目:jdk8u_jdk    文件:JarInputStream.java   
/**
 * Reads the next ZIP file entry and positions the stream at the
 * beginning of the entry data. If verification has been enabled,
 * any invalid signature detected while positioning the stream for
 * the next entry will result in an exception.
 * @exception ZipException if a ZIP file error has occurred
 * @exception IOException if an I/O error has occurred
 * @exception SecurityException if any of the jar file entries
 *         are incorrectly signed.
 */
public ZipEntry getNextEntry() throws IOException {
    JarEntry e;
    if (first == null) {
        e = (JarEntry)super.getNextEntry();
        if (tryManifest) {
            e = checkManifest(e);
            tryManifest = false;
        }
    } else {
        e = first;
        if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
            tryManifest = true;
        first = null;
    }
    if (jv != null && e != null) {
        // At this point, we might have parsed all the meta-inf
        // entries and have nothing to verify. If we have
        // nothing to verify, get rid of the JarVerifier object.
        if (jv.nothingToVerify() == true) {
            jv = null;
            mev = null;
        } else {
            jv.beginEntry(e, mev);
        }
    }
    return e;
}
项目:jdk8u_jdk    文件:URLClassPath.java   
JarIndex getIndex() {
    try {
        ensureOpen();
    } catch (IOException e) {
        throw new InternalError(e);
    }
    return index;
}
项目:jdk8u_jdk    文件:Main.java   
private void addIndex(JarIndex index, ZipOutputStream zos)
    throws IOException
{
    ZipEntry e = new ZipEntry(INDEX_NAME);
    e.setTime(System.currentTimeMillis());
    if (flag0) {
        CRC32OutputStream os = new CRC32OutputStream();
        index.write(os);
        os.updateEntry(e);
    }
    zos.putNextEntry(e);
    index.write(zos);
    zos.closeEntry();
}
项目:jdk8u_jdk    文件:JarIndexMergeTest.java   
public static void main(String[] args) throws Exception {
    File jar1 = buildJar1();
    File jar2 = buildJar2();

    JarIndex jarIndex1 = new JarIndex(new String[] { jar1.getAbsolutePath() });
    JarIndex jarIndex2 = new JarIndex(new String[] { jar2.getAbsolutePath() });

    jarIndex1.merge(jarIndex2, null);

    assertFileResolved(jarIndex2, "com/test1/resource1.file",
                       jar1.getAbsolutePath());
    assertFileResolved(jarIndex2, "com/test2/resource2.file",
                       jar2.getAbsolutePath());
}
项目:jdk8u_jdk    文件:JarIndexMergeTest.java   
static void assertFileResolved(JarIndex jarIndex2, String file,
                               String jarName) {
    @SuppressWarnings("unchecked")
    LinkedList<String> jarLists = (LinkedList<String>)jarIndex2.get(file);
    if (jarLists == null || jarLists.size() == 0 ||
        !jarName.equals(jarLists.get(0))) {
        throw new RuntimeException(
            "Unexpected result: the merged index must resolve file: "
            + file);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:JarInputStream.java   
/**
 * Reads the next ZIP file entry and positions the stream at the
 * beginning of the entry data. If verification has been enabled,
 * any invalid signature detected while positioning the stream for
 * the next entry will result in an exception.
 * @exception ZipException if a ZIP file error has occurred
 * @exception IOException if an I/O error has occurred
 * @exception SecurityException if any of the jar file entries
 *         are incorrectly signed.
 */
public ZipEntry getNextEntry() throws IOException {
    JarEntry e;
    if (first == null) {
        e = (JarEntry)super.getNextEntry();
        if (tryManifest) {
            e = checkManifest(e);
            tryManifest = false;
        }
    } else {
        e = first;
        if (first.getName().equalsIgnoreCase(JarIndex.INDEX_NAME))
            tryManifest = true;
        first = null;
    }
    if (jv != null && e != null) {
        // At this point, we might have parsed all the meta-inf
        // entries and have nothing to verify. If we have
        // nothing to verify, get rid of the JarVerifier object.
        if (jv.nothingToVerify() == true) {
            jv = null;
            mev = null;
        } else {
            jv.beginEntry(e, mev);
        }
    }
    return e;
}
项目:lookaside_java-1.8.0-openjdk    文件:URLClassPath.java   
JarIndex getIndex() {
    try {
        ensureOpen();
    } catch (IOException e) {
        throw new InternalError(e);
    }
    return index;
}
项目:lookaside_java-1.8.0-openjdk    文件:Main.java   
private void addIndex(JarIndex index, ZipOutputStream zos)
    throws IOException
{
    ZipEntry e = new ZipEntry(INDEX_NAME);
    e.setTime(System.currentTimeMillis());
    if (flag0) {
        CRC32OutputStream os = new CRC32OutputStream();
        index.write(os);
        os.updateEntry(e);
    }
    zos.putNextEntry(e);
    index.write(zos);
    zos.closeEntry();
}
项目:lookaside_java-1.8.0-openjdk    文件:JarIndexMergeTest.java   
public static void main(String[] args) throws Exception {
    File jar1 = buildJar1();
    File jar2 = buildJar2();

    JarIndex jarIndex1 = new JarIndex(new String[] { jar1.getAbsolutePath() });
    JarIndex jarIndex2 = new JarIndex(new String[] { jar2.getAbsolutePath() });

    jarIndex1.merge(jarIndex2, null);

    assertFileResolved(jarIndex2, "com/test1/resource1.file",
                       jar1.getAbsolutePath());
    assertFileResolved(jarIndex2, "com/test2/resource2.file",
                       jar2.getAbsolutePath());
}