⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preverificationresults.java

📁 eclipseme的最新版本的source,欢迎j2me程序员使用
💻 JAVA
字号:
/**
 * Copyright (c) 2003-2004 Craig Setera
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 */
package eclipseme.preverifier.results;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.util.TraceClassVisitor;

/**
 * Results of the preverification.
 * <p />
 * Copyright (c) 2003-2004 Craig Setera<br>
 * All Rights Reserved.<br>
 * Licensed under the Eclipse Public License - v 1.0<p/>
 * <br>
 * $Revision: 1.1 $
 * <br>
 * $Date: 2005/09/25 23:53:31 $
 * <br>
 * @author Craig Setera
 */
public class PreverificationResults {
	private ClassNode preverifiedClassNode;
	private byte[] preverifiedClassBytes;
	private PreverificationError[] errors;
	
	/**
	 * Construct a new preverication result.
	 * 
	 * @param preverifiedClassBytes
	 * @param errors
	 */
	public PreverificationResults(
		ClassNode preverifiedClassNode,
		byte[] preverifiedClassBytes,
		PreverificationError[] errors) 
	{
		this.preverifiedClassNode = preverifiedClassNode;
		this.preverifiedClassBytes = preverifiedClassBytes;
		this.errors = errors;
	}
	
	/**
	 * @return Returns the errors.
	 */
	public PreverificationError[] getErrors() {
		return errors;
	}
	
	/**
	 * @return Returns the preverifiedClassBytes.
	 */
	public byte[] getPreverifiedClassBytes() {
		return preverifiedClassBytes;
	}

	/**
	 * @return Returns the preverifiedClassNode.
	 */
	public ClassNode getPreverifiedClassNode() {
		return preverifiedClassNode;
	}

	/**
	 * Return the disassembled class output or <code>null</code> if there
	 * were errors while doing the preverification.
	 * 
	 * @return
	 */
	public String getDisassembledOutput() {
		String traceOutput = null;
		
		if (errors.length == 0) {
			StringWriter stringWriter = new StringWriter();
			PrintWriter printWriter = new PrintWriter(stringWriter);
			TraceClassVisitor traceVisitor = new TraceClassVisitor(printWriter);
			preverifiedClassNode.accept(traceVisitor);
			printWriter.close();
			traceOutput = stringWriter.toString();
		}
		
		return traceOutput;
	}
	
	/**
	 * Return a boolean indicating whether the result was an error result.
	 * 
	 * @return
	 */
	public boolean isErrorResult() {
		return errors.length > 0;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -