• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DexPool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: writeRawDexSingleThread

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
static void writeRawDexSingleThread(DexDataStore dataStore, DexFile dexFile, int maxDexPoolSize,
		DexIO.Logger logger, File file) throws IOException {
	Set<? extends ClassDef> classes = dexFile.getClasses();
	Iterator<? extends ClassDef> classIterator = classes.iterator();
	DexPool dexPool = new DexPool(dexFile.getOpcodes());
	int classCount = 0;
	while (classIterator.hasNext()) {
		ClassDef classDef = classIterator.next();
		dexPool.internClass(classDef);
		if (getDexPoolOverflow(dexPool, maxDexPoolSize)) {
			handleDexPoolOverflow(classDef, classCount, classes.size());
			throw new AssertionError("unexpected type count");
		}
		classCount++;
	}
	if (logger != null) logger.log(file, SingletonDexContainer.UNDEFINED_ENTRY_NAME, classCount);
	dexPool.writeTo(dataStore);
}
 
开发者ID:DexPatcher,项目名称:multidexlib2,代码行数:19,代码来源:DexIO.java


示例2: getDexPoolOverflow

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
private static boolean getDexPoolOverflow(DexPool dexPool, int maxDexPoolSize) {
	return
			dexPool.typeSection.getItemCount() > maxDexPoolSize ||
			//dexPool.protoSection.getItemCount() > maxDexPoolSize ||
			dexPool.fieldSection.getItemCount() > maxDexPoolSize ||
			dexPool.methodSection.getItemCount() > maxDexPoolSize ||
			//dexPool.classSection.getItemCount() > maxDexPoolSize ||
			false;
}
 
开发者ID:DexPatcher,项目名称:multidexlib2,代码行数:10,代码来源:DexIO.java


示例3: merge

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
public void merge(){
	try {
		DexBackedDexFile addfile = DexFileFactory.loadDexFile(add_path, config.API_LEVEL);
		dexfile.setaddDexFile(addfile, new FilterClassDef() {
			
			@Override
			public DexBackedClassDef rewrite(DexBackedClassDef classDef) {
				// TODO Auto-generated method stub
				String className = classDef.getType();
				if (ADD_ALL) {
					if (!className.startsWith("Landroid") && 
							!className.startsWith("Ljava") &&
							!className.startsWith("Ldalvik")) {
							return classDef;
					}else{
						return null;
					}
				}
				
				if (internedItem.containsKey(className)) {
					System.out.println("contain " + className);
					return classDef;
				}
				return null;
			}
		});

		DexRewriter rewriter = new DexRewriter(new RewriterModule());
		DexFile rewrittenDexFile = rewriter.rewriteDexFile(dexfile);
		DexPool.writeTo(config.outPath, rewrittenDexFile);
		config.hasModifed = true;
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:CvvT,项目名称:DexTamper,代码行数:37,代码来源:MergeDex.java


示例4: writeDexFile

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
public static void writeDexFile(String path, DexFile dexFile) throws IOException {
    DexPool.writeTo(path, dexFile);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:4,代码来源:DexFileFactory.java


示例5: rewriteDex

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
public void rewriteDex(final onWriteListener listener) throws IOException {
        final DexRewriter rewriter = new DexRewriter(new RewriterModule() {
            @Nonnull
            @Override
            public Rewriter<Method> getMethodRewriter(@Nonnull Rewriters rewriters) {
                return new MethodRewriter(rewriters) {
                    @Nonnull
                    @Override
                    public Method rewrite(@Nonnull Method value) {
                        if (listener != null) {
                            final MethodImplementation implementation = listener.rewriteMethod(value);
                            if (implementation != null) {
                                return new RewrittenMethod(value){
                                    public MethodImplementation getImplementation() {
                                        return implementation;
                                    }
                                };
                            }
                        }
                        return new RewrittenMethod(value);
                    }
                };
            }

//            @Nonnull
//            public Rewriter<ClassDef> getClassDefRewriter(@Nonnull Rewriters rewriters){
//                return new ClassDefRewriter(rewriters){
//                    @Nonnull
//                    @Override
//                    public ClassDef rewrite(@Nonnull ClassDef classDef) {
//                        return new RewrittenClassDef(classDef){
//                            @Nonnull
//                            @Override
//                            public Iterable<? extends Method> getVirtualMethods(){
//                                if (listener != null) {
//                                    final List<Method> addmethods = listener.addMethods(classDef);
//                                    if (addmethods != null && addmethods.size() > 0) {
//                                        Iterable<Method> tmp = new Iterable<Method>() {
//                                            @Override
//                                            public Iterator<Method> iterator() {
//                                                Iterable<? extends Method> iterator = classDef.getVirtualMethods();
//                                                return Iterators.concat(iterator.iterator(), addmethods.iterator());
//                                            }
//                                        };
//                                        return RewriterUtils.rewriteIterable(rewriters.getMethodRewriter(), tmp);
//                                    }
//                                }
//                                return RewriterUtils.rewriteIterable(rewriters.getMethodRewriter(), classDef.getVirtualMethods());
//                            }
//                        };
//                    }
//                };
//            }
        }) {
            @Nonnull
            @Override
            public DexFile rewriteDexFile(@Nonnull DexFile dexFile) {
                return new RewrittenDexFile(dexFile) {
                    @Nonnull
                    @Override
                    public Set<? extends ClassDef> getClasses() {
                        Set<? extends ClassDef> classes = dexFile.getClasses();
                        if (listener != null) {
                            Set<ClassDef> addclasses = listener.addClasses();
                            addclasses.addAll(classes);
                            return RewriterUtils.rewriteSet(getClassDefRewriter(), addclasses);
                        }
                        return RewriterUtils.rewriteSet(getClassDefRewriter(), dexfile.getClasses());
                    }
                };
            }
        };

        DexFile rewritefile = rewriter.rewriteDexFile(dexfile);
        DexPool.writeTo("out.dex", rewritefile);
    }
 
开发者ID:CvvT,项目名称:andbg,代码行数:77,代码来源:Context.java


示例6: writeDexFile

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
public static void writeDexFile(@Nonnull String path, @Nonnull DexFile dexFile) throws IOException {
    DexPool.writeTo(path, dexFile);
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:4,代码来源:DexFileFactory.java


示例7: modify

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
public void modify() throws IOException{
	DexFile rewrittenDexFile = rewriter.rewriteDexFile(this.dexFile);
	DexPool.writeTo(config.outPath, rewrittenDexFile);
	config.hasModifed = true;
}
 
开发者ID:CvvT,项目名称:DexTamper,代码行数:6,代码来源:MethodWithoutParams.java


示例8: writeDexFile

import org.jf.dexlib2.writer.pool.DexPool; //导入依赖的package包/类
/**
 * Writes a DexFile out to disk
 *
 * @param path The path to write the dex file to
 * @param dexFile a DexFile to write
 */
public static void writeDexFile( String path,  DexFile dexFile) throws IOException {
    DexPool.writeTo(path, dexFile);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:10,代码来源:DexFileFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XmlStringUtil类代码示例发布时间:2022-05-22
下一篇:
Java Kind类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap