Examples of PackingFile


Examples of org.apache.harmony.pack200.Archive.PackingFile

        // add manifest file
        Manifest manifest = jarInputStream.getManifest();
        if (manifest != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            manifest.write(baos);
            packingFileList.add(new PackingFile(JarFile.MANIFEST_NAME, baos
                    .toByteArray(), 0));
        }

        // add rest of entries in the jar
        JarEntry jarEntry;
        byte[] bytes;
        while ((jarEntry = jarInputStream.getNextJarEntry()) != null) {
            bytes = readJarEntry(jarEntry, new BufferedInputStream(
                    jarInputStream));
            packingFileList.add(new PackingFile(bytes, jarEntry));
        }

        // check whether it need reorder packing file list
        if (!keepFileOrder) {
            reorderPackingFiles(packingFileList);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        byte[] bytes;
        while (jarEntries.hasMoreElements()) {
            jarEntry = (JarEntry) jarEntries.nextElement();
            bytes = readJarEntry(jarEntry, new BufferedInputStream(jarFile
                    .getInputStream(jarEntry)));
            packingFileList.add(new PackingFile(bytes, jarEntry));
        }

        // check whether it need reorder packing file list
        if (!keepFileOrder) {
            reorderPackingFiles(packingFileList);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        return bytes;
    }

    private static void reorderPackingFiles(List packingFileList) {
        Iterator iterator = packingFileList.iterator();
        PackingFile packingFile;
        while (iterator.hasNext()) {
            packingFile = (PackingFile) iterator.next();
            if (packingFile.isDirectory()) {
                // remove directory entries
                iterator.remove();
            }
        }
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

                classBands.removeCurrentClass();
                String name = classReader.getFileName();
                boolean found = false;
                for (Iterator iterator2 = segmentUnit.getFileList().iterator(); iterator2
                        .hasNext();) {
                    PackingFile file = (PackingFile) iterator2.next();
                    if(file.getName().equals(name)) {
                        found = true;
                        file.setContents(classReader.b);
                        break;
                    }
                }
                if(!found) {
                    throw new Pack200Exception("Error passing file " + name);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        long modtime;
        int latestModtime = Integer.MIN_VALUE;
        boolean isLatest = !PackingOptions.KEEP.equals(options
                .getModificationTime());
        for (int i = 0; i < size; i++) {
            PackingFile packingFile = (PackingFile) fileList.get(i);
            String name = packingFile.getName();
            if (name.endsWith(".class") && !options.isPassFile(name)) {
                file_options[i] |= (1 << 1);
                if (classNames.contains(name.substring(0, name.length() - 6))) {
                    fileName[i] = emptyString;
                } else {
                    fileName[i] = cpBands.getCPUtf8(name);
                }
            } else {
                fileName[i] = cpBands.getCPUtf8(name);
            }
            // set deflate_hint for file element
            if (options.isKeepDeflateHint() && packingFile.isDefalteHint()) {
                file_options[i] |= 0x1;
            }
            byte[] bytes = packingFile.getContents();
            file_size[i] = bytes.length;
            totalSize += file_size[i];

            // update modification time
            modtime = (packingFile.getModtime() + TimeZone.getDefault().getRawOffset()) / 1000L;
            file_modtime[i] = (int) (modtime - archiveModtime);
            if (isLatest && latestModtime < file_modtime[i]) {
                latestModtime = file_modtime[i];
            }

            file_bits[i] = packingFile.getContents();
        }

        if (isLatest) {
            for (int index = 0; index < size; index++) {
                file_modtime[index] = latestModtime;
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

                classBands.removeCurrentClass();
                String name = classReader.getFileName();
                boolean found = false;
                for (Iterator iterator2 = segmentUnit.getFileList().iterator(); iterator2
                        .hasNext();) {
                    PackingFile file = (PackingFile) iterator2.next();
                    if(file.getName().equals(name)) {
                        found = true;
                        file.setContents(classReader.b);
                        break;
                    }
                }
                if(!found) {
                    throw new Pack200Exception("Error passing file " + name);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        // add manifest file
        Manifest manifest = jarInputStream.getManifest();
        if (manifest != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            manifest.write(baos);
            packingFileList.add(new PackingFile(JarFile.MANIFEST_NAME, baos
                    .toByteArray(), 0));
        }

        // add rest of entries in the jar
        JarEntry jarEntry;
        byte[] bytes;
        while ((jarEntry = jarInputStream.getNextJarEntry()) != null) {
            bytes = readJarEntry(jarEntry, new BufferedInputStream(
                    jarInputStream));
            packingFileList.add(new PackingFile(bytes, jarEntry));
        }

        // check whether it need reorder packing file list
        if (!keepFileOrder) {
            reorderPackingFiles(packingFileList);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        byte[] bytes;
        while (jarEntries.hasMoreElements()) {
            jarEntry = (JarEntry) jarEntries.nextElement();
            bytes = readJarEntry(jarEntry, new BufferedInputStream(jarFile
                    .getInputStream(jarEntry)));
            packingFileList.add(new PackingFile(bytes, jarEntry));
        }

        // check whether it need reorder packing file list
        if (!keepFileOrder) {
            reorderPackingFiles(packingFileList);
View Full Code Here

Examples of org.apache.harmony.pack200.Archive.PackingFile

        return bytes;
    }

    private static void reorderPackingFiles(List packingFileList) {
        Iterator iterator = packingFileList.iterator();
        PackingFile packingFile;
        while (iterator.hasNext()) {
            packingFile = (PackingFile) iterator.next();
            if (packingFile.isDirectory()) {
                // remove directory entries
                iterator.remove();
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.