当前位置: 首页>>代码示例>>Java>>正文


Java ProgramClassWriter类代码示例

本文整理汇总了Java中proguard.classfile.io.ProgramClassWriter的典型用法代码示例。如果您正苦于以下问题:Java ProgramClassWriter类的具体用法?Java ProgramClassWriter怎么用?Java ProgramClassWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProgramClassWriter类属于proguard.classfile.io包,在下文中一共展示了ProgramClassWriter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import proguard.classfile.io.ProgramClassWriter; //导入依赖的package包/类
public void read(DataEntry dataEntry) throws IOException
{
    String inputName = dataEntry.getName();
    String className = inputName.substring(0, inputName.length() - ClassConstants.CLASS_FILE_EXTENSION.length());

    // Find the modified class corrsponding to the input entry.
    ProgramClass programClass = (ProgramClass)classPool.getClass(className);
    if (programClass != null)
    {
        // Rename the data entry if necessary.
        String newClassName = programClass.getName();
        if (!className.equals(newClassName))
        {
            dataEntry = new RenamedDataEntry(dataEntry, newClassName + ClassConstants.CLASS_FILE_EXTENSION);
        }

        // Get the output entry corresponding to this input entry.
        OutputStream outputStream = dataEntryWriter.getOutputStream(dataEntry);
        if (outputStream != null)
        {
            // Write the class to the output entry.
            DataOutputStream classOutputStream = new DataOutputStream(outputStream);

            new ProgramClassWriter(classOutputStream).visitProgramClass(programClass);

            classOutputStream.flush();
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:30,代码来源:ClassRewriter.java

示例2: visitProgramClass

import proguard.classfile.io.ProgramClassWriter; //导入依赖的package包/类
public void visitProgramClass(ProgramClass programClass)
{
    // Rename the data entry if necessary.
    String    actualClassName = programClass.getName();
    DataEntry actualDataEntry =
        new RenamedDataEntry(templateDataEntry,
                             actualClassName + ClassConstants.CLASS_FILE_EXTENSION);

    try
    {
        // Get the output entry corresponding to this input entry.
        OutputStream outputStream = dataEntryWriter.getOutputStream(actualDataEntry);
        if (outputStream != null)
        {
            // Write the class to the output entry.
            DataOutputStream classOutputStream = new DataOutputStream(outputStream);

            new ProgramClassWriter(classOutputStream).visitProgramClass(programClass);

            classOutputStream.flush();
        }
    }
    catch (IOException e)
    {
        throw new RuntimeException("Can't write program class ["+actualClassName+"] to ["+actualDataEntry+"] ("+e.getMessage()+")", e);
    }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:28,代码来源:DataEntryClassWriter.java


注:本文中的proguard.classfile.io.ProgramClassWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。