Package org.apache.harmony.unpack200

Examples of org.apache.harmony.unpack200.Archive


        assertEquals("1", tuple.simpleClassName());
        assertEquals("java/util/AbstractList", tuple.outerClassString());
    }

    public void testExplicitClassTupleParsing() {
        IcTuple tuple = new IcTuple("Foo$$2$Local", IcTuple.NESTED_CLASS_FLAG,
                null, "$2$Local", -1, -1, -1);
        assertEquals("$2$Local", tuple.simpleClassName());
        assertEquals("Foo$$2", tuple.outerClassString());

        tuple = new IcTuple("Red$Herring", IcTuple.NESTED_CLASS_FLAG,
                "Red$Herring", null, -1, -1, -1);
        assertEquals("Herring", tuple.simpleClassName());
        assertEquals("Red$Herring", tuple.outerClassString());

        tuple = new IcTuple("X$1$Q", IcTuple.NESTED_CLASS_FLAG, "X$1", "Q", -1,
                -1, -1);
        assertEquals("Q", tuple.simpleClassName());
        assertEquals("X$1", tuple.outerClassString());
    }
View Full Code Here


    public void testJustResources() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack");
        file = File.createTempFile("just", "resources.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
    }
View Full Code Here

    public void testInterfaceOnly() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack");
        file = File.createTempFile("Interface", "Only.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
    }
View Full Code Here

    public void testHelloWorld() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
        file = File.createTempFile("hello", "world.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
        out.close();
        out = null;
        JarFile jarFile = new JarFile(file);
        file.deleteOnExit();
        JarEntry entry = jarFile
View Full Code Here

    public void testIndex() {
        pool.add(new CPUTF8("OtherThing", 1));
        CPUTF8 u1 = new CPUTF8("thing", 2);
        pool.add(u1);
        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }
View Full Code Here

public class BandSetTest extends TestCase {

    public class MockSegment extends Segment {

        public SegmentHeader getSegmentHeader() {
            return new SegmentHeader(this);
        }
View Full Code Here

    public void testUnused() {
        int[] unused = new int[] { 3, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
                23, 24, 25, 26, 27, 28, 29, 30, 31 };
        for (int i = 0; i < unused.length; i++) {
            try {
                new SegmentOptions(1 << unused[i]);
                fail("Bit "
                        + unused[i]
                        + " should be unused, but it's not caught during construction");
            } catch (Pack200Exception e) {
                assertTrue(true);
View Full Code Here

            return numClasses;
        }

        public SegmentOptions getOptions() {
            try {
                return new SegmentOptions(0);
            } catch (Pack200Exception e) {
                return null;
            }
        }
View Full Code Here

        // that will
        // be written out. Keep SourceFileAttributes out since we just
        // did them above.
        ArrayList classAttributesWithoutSourceFileAttribute = new ArrayList(classAttributes.size());
        for (int index = 0; index < classAttributes.size(); index++) {
            Attribute attrib = (Attribute) classAttributes.get(index);
            if (!attrib.isSourceFileAttribute()) {
                classAttributesWithoutSourceFileAttribute.add(attrib);
            }
        }
        Attribute[] originalAttributes = classFile.attributes;
        classFile.attributes = new Attribute[originalAttributes.length
                + classAttributesWithoutSourceFileAttribute.size()];
        System.arraycopy(originalAttributes, 0, classFile.attributes, 0,
                originalAttributes.length);
        for (int index = 0; index < classAttributesWithoutSourceFileAttribute
                .size(); index++) {
            Attribute attrib = ((Attribute) classAttributesWithoutSourceFileAttribute
                    .get(index));
            cp.add(attrib);
            classFile.attributes[originalAttributes.length + index] = attrib;
        }
View Full Code Here

            String innerClassString = icStored.thisClassString();
            String outerClassString = icStored.outerClassString();
            String simpleClassName = icStored.simpleClassName();

            CPClass innerClass = null;
            CPUTF8 innerName = null;
            CPClass outerClass = null;

            innerClass = innerClassIndex != -1 ? cpBands
                    .cpClassValue(innerClassIndex) : cpBands
                    .cpClassValue(innerClassString);
            if (!icStored.isAnonymous()) {
View Full Code Here

TOP

Related Classes of org.apache.harmony.unpack200.Archive

Copyright © 2018 www.massapicom. 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.