Package com.antlersoft.classwriter

Examples of com.antlersoft.classwriter.ClassWriter$CPUtf8


        public void run()
        {
            Stack directoryStack=new Stack();
            directoryStack.push( classUrl);
            Filesystem system=classUrl.getFilesystem();
            ClassWriter classwriter=new ClassWriter();
            final long startTime=System.currentTimeMillis();
            try
            {
                while ( ! directoryStack.isEmpty())
                {
                    Url currentDirectory=(Url)directoryStack.pop();
                    Url[] contents=system.getChildren( currentDirectory, null,
                        Filesystem.TYPE_BOTH);
                    for ( int i=0; i<contents.length; i++)
                    {
                        if ( system.isDirectory( contents[i]))
                            directoryStack.push( contents[i]);
                        else
                        {
                            if ( contents[i].getFileExtension().
                                equals( "class") &&
                                system.getLastModified( contents[i])>
                                lastModified)
                            {
System.out.println( "Analyzing "+contents[i].toString());
                                BufferedInputStream bis=
                                    new BufferedInputStream(
                                    system.getInputStream( contents[i]));
                                classwriter.readClass( bis);
                                DBClass.addClassToDB( classwriter,
                                    db);
                                bis.close();
                            }
                        }
View Full Code Here


* Tests for pack200 support for non-predefined attributes
*/
public class NewAttributeBandsTest extends TestCase {

    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

        tryIntegral("OSI");
        tryIntegral("POI");
    }

    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());
View Full Code Here

        Integral element = (Integral) layoutElements.get(0);
        assertEquals(layoutStr, element.getTag());
    }

    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());
View Full Code Here

        tryReference("RQNH");
        tryReference("RQNI");
    }

    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());
View Full Code Here

        Reference element = (Reference) layoutElements.get(0);
        assertEquals(layoutStr, element.getTag());
    }

    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());
View Full Code Here

        Reference ref = (Reference) defaultBody.get(0);
        assertEquals("RSH", ref.getTag());
    }

    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();
View Full Code Here

        assertEquals(1, call.getCallableIndex());
        assertEquals(secondCallable, call.getCallable());
    }

    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));
View Full Code Here

        assertEquals(56, bytes[1]);
        assertEquals(3, bytes[2]);
    }

    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;
View Full Code Here

TOP

Related Classes of com.antlersoft.classwriter.ClassWriter$CPUtf8

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.