Java 类org.eclipse.jdt.core.util.ClassFileBytesDisassembler 实例源码

项目:codelens-eclipse    文件:JDTUtils.java   
public static String disassemble(IClassFile classFile) {
    ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
    String disassembledByteCode = null;
    try {
        disassembledByteCode = disassembler.disassemble(classFile.getBytes(), LF,
                ClassFileBytesDisassembler.WORKING_COPY);
        disassembledByteCode = MISSING_SOURCES_HEADER + LF + disassembledByteCode;
    } catch (Exception e) {
        // JavaLanguageServerPlugin.logError("Unable to disassemble " +
        // classFile.getHandleIdentifier());
        e.printStackTrace();
    }
    return disassembledByteCode;
}
项目:eclipse.jdt.ls    文件:DisassemblerContentProvider.java   
private String getContent(byte[] bytes, IProgressMonitor monitor) throws CoreException {
    ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
    String disassembledByteCode = null;
    try {
        disassembledByteCode = disassembler.disassemble(bytes, LF, ClassFileBytesDisassembler.WORKING_COPY);
        if (disassembledByteCode != null) {
            disassembledByteCode = DISASSEMBLED_HEADER + disassembledByteCode;
        }
    } catch (ClassFormatException e) {
        throw new CoreException(new Status(Status.ERROR, "", "Error disassembling", e));
    }
    return disassembledByteCode;
}
项目:Eclipse-Postfix-Code-Completion    文件:ClassFileWorkingCopy.java   
/**
 * @see Openable#openBuffer(IProgressMonitor, Object)
 */
protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {

    // create buffer
    IBuffer buffer = BufferManager.createBuffer(this);

    // set the buffer source
    IBuffer classFileBuffer = this.classFile.getBuffer();
    if (classFileBuffer != null) {
        buffer.setContents(classFileBuffer.getCharacters());
    } else {
        // Disassemble
        IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
        Disassembler disassembler = new Disassembler();
        String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
        buffer.setContents(contents);
    }

    // add buffer to buffer cache
    BufferManager bufManager = getBufferManager();
    bufManager.addBuffer(buffer);

    // listen to buffer changes
    buffer.addBufferChangedListener(this);

    return buffer;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ClassFileWorkingCopy.java   
/**
 * @see Openable#openBuffer(IProgressMonitor, Object)
 */
protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {

    // create buffer
    IBuffer buffer = BufferManager.createBuffer(this);

    // set the buffer source
    IBuffer classFileBuffer = this.classFile.getBuffer();
    if (classFileBuffer != null) {
        buffer.setContents(classFileBuffer.getCharacters());
    } else {
        // Disassemble
        IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
        Disassembler disassembler = new Disassembler();
        String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
        buffer.setContents(contents);
    }

    // add buffer to buffer cache
    BufferManager bufManager = getBufferManager();
    bufManager.addBuffer(buffer);

    // listen to buffer changes
    buffer.addBufferChangedListener(this);

    return buffer;
}
项目:Eclipse-Postfix-Code-Completion    文件:DefaultBytecodeVisitor.java   
private boolean isCompact() {
    return (this.mode & ClassFileBytesDisassembler.COMPACT) != 0;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:DefaultBytecodeVisitor.java   
private boolean isCompact() {
    return (this.mode & ClassFileBytesDisassembler.COMPACT) != 0;
}
项目:che    文件:ToolFactory.java   
/**
 * Create a classfile bytecode disassembler, able to produce a String representation of a given
 * classfile.
 *
 * @return a classfile bytecode disassembler
 * @see org.eclipse.jdt.core.util.ClassFileBytesDisassembler
 * @since 2.1
 */
public static ClassFileBytesDisassembler createDefaultClassFileBytesDisassembler() {
  return new Disassembler();
}
项目:Eclipse-Postfix-Code-Completion    文件:ToolFactory.java   
/**
 * Create a classfile bytecode disassembler, able to produce a String representation of a given classfile.
 *
 * @return a classfile bytecode disassembler
 * @see ClassFileBytesDisassembler
 * @since 2.1
 */
public static ClassFileBytesDisassembler createDefaultClassFileBytesDisassembler(){
    return new Disassembler();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ToolFactory.java   
/**
 * Create a classfile bytecode disassembler, able to produce a String representation of a given classfile.
 *
 * @return a classfile bytecode disassembler
 * @see ClassFileBytesDisassembler
 * @since 2.1
 */
public static ClassFileBytesDisassembler createDefaultClassFileBytesDisassembler(){
    return new Disassembler();
}