Package org.apache.harmony.pack200.AttributeDefinitionBands

Examples of org.apache.harmony.pack200.AttributeDefinitionBands.AttributeDefinition


        in = new JarInputStream(
                Archive.class
                        .getResourceAsStream("/org/apache/harmony/pack200/tests/hw.jar"));
        file = File.createTempFile("helloworld", ".pack.gz");
        out = new FileOutputStream(file);
        new Archive(in, out, true).pack();
        in.close();
        out.close();

        // now unpack
        InputStream in2 = new FileInputStream(file);
View Full Code Here


    public void testEmptyLayout() throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8("");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(0, layoutElements.size());
    }
View Full Code Here

    private void tryIntegral(String layoutStr) throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8(layoutStr);
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(1, layoutElements.size());
        Integral element = (Integral) layoutElements.get(0);
        assertEquals(layoutStr, element.getTag());
View Full Code Here

    public void testReplicationLayouts() throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8("NH[PHOHRUHRSHH]");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(1, layoutElements.size());
        Replication element = (Replication) layoutElements.get(0);
        Integral countElement = element.getCountElement();
View Full Code Here

    private void tryReference(String layoutStr) throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8(layoutStr);
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(1, layoutElements.size());
        Reference element = (Reference) layoutElements.get(0);
        assertEquals(layoutStr, element.getTag());
View Full Code Here

    public void testUnionLayout() throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8("TB(55)[FH](23)[]()[RSH]");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(1, layoutElements.size());
        Union element = (Union) layoutElements.get(0);
        Integral tag = element.getUnionTag();
View Full Code Here

    public void testLayoutWithCalls() throws IOException {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8(
                "[NH[(1)]][RSH NH[RUH(1)]][TB(66,67,73,83,90)[KIH](68)[KDH](70)[KFH](74)[KJH](99)[RSH](101)[RSH RUH](115)[RUH](91)[NH[(0)]](64)[RSH[RUH(0)]]()[]]");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        List layoutElements = newAttributeBands.getLayoutElements();
        assertEquals(3, layoutElements.size());
        Callable firstCallable = (Callable) layoutElements.get(0);
        Callable secondCallable = (Callable) layoutElements.get(1);
View Full Code Here

    public void testAddAttributes() throws IOException, Pack200Exception {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8("B");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        newAttributeBands.addAttribute(new NewAttribute(null, "TestAttribute", "B", new byte[] {27}, null, 0, null));
        newAttributeBands.addAttribute(new NewAttribute(null, "TestAttribute", "B", new byte[] {56}, null, 0, null));
        newAttributeBands.addAttribute(new NewAttribute(null, "TestAttribute", "B", new byte[] {3}, null, 0, null));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

    public void testAddAttributesWithReplicationLayout() throws IOException, Pack200Exception {
        CPUTF8 name = new CPUTF8("TestAttribute");
        CPUTF8 layout = new CPUTF8("NB[SH]");
        MockNewAttributeBands newAttributeBands = new MockNewAttributeBands(1,
                null, null, new AttributeDefinition(35,
                        AttributeDefinitionBands.CONTEXT_CLASS, name, layout));
        newAttributeBands.addAttribute(new NewAttribute(null, "TestAttribute", "B", new byte[] {1, 0, 100}, null, 0, null));
        short s = -50;
        byte b1 = (byte)(s>>>8);
        byte b2 = (byte)s;
View Full Code Here

    }

    private void createNewAttributeBands() throws IOException {
        List classAttributeLayouts = attrBands.getClassAttributeLayouts();
        for (Iterator iterator = classAttributeLayouts.iterator(); iterator.hasNext();) {
            AttributeDefinition def = (AttributeDefinition) iterator.next();
            classAttributeBands.add(new NewAttributeBands(effort, cpBands, segment.getSegmentHeader(), def));
        }
        List methodAttributeLayouts = attrBands.getMethodAttributeLayouts();
        for (Iterator iterator = methodAttributeLayouts.iterator(); iterator.hasNext();) {
            AttributeDefinition def = (AttributeDefinition) iterator.next();
            methodAttributeBands.add(new NewAttributeBands(effort, cpBands, segment.getSegmentHeader(), def));
        }
        List fieldAttributeLayouts = attrBands.getFieldAttributeLayouts();
        for (Iterator iterator = fieldAttributeLayouts.iterator(); iterator.hasNext();) {
            AttributeDefinition def = (AttributeDefinition) iterator.next();
            fieldAttributeBands.add(new NewAttributeBands(effort, cpBands, segment.getSegmentHeader(), def));
        }
        List codeAttributeLayouts = attrBands.getCodeAttributeLayouts();
        for (Iterator iterator = codeAttributeLayouts.iterator(); iterator.hasNext();) {
            AttributeDefinition def = (AttributeDefinition) iterator.next();
            codeAttributeBands.add(new NewAttributeBands(effort, cpBands, segment.getSegmentHeader(), def));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.pack200.AttributeDefinitionBands.AttributeDefinition

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.