Example usage for org.eclipse.jdt.core.util IClassFileReader ALL_BUT_METHOD_BODIES

List of usage examples for org.eclipse.jdt.core.util IClassFileReader ALL_BUT_METHOD_BODIES

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.util IClassFileReader ALL_BUT_METHOD_BODIES.

Prototype

int ALL_BUT_METHOD_BODIES

To view the source code for org.eclipse.jdt.core.util IClassFileReader ALL_BUT_METHOD_BODIES.

Click Source Link

Document

This value should be used to read the whole contents of the .class file except the method bodies.

Usage

From source file:org.eclipse.pde.tools.internal.versioning.ClassFileHelper.java

License:Open Source License

/**
 * gets IClassFileReader of the java class denoted by <code>file</code>
 * @param file java class file//from  w w w . jav  a  2s.co m
 * @return IClassFileReader instance or <code>null</code>if file type is wrong or any error occurred
 */
private static IClassFileReader getClassReaderFromFile(File file) {
    if (isGivenTypeFile(file, CLASS_FILE_EXTENSION))
        return ToolFactory.createDefaultClassFileReader(file.getAbsolutePath(),
                IClassFileReader.ALL_BUT_METHOD_BODIES);
    if (isGivenTypeFile(file, JAVA_FILE_EXTENSION))
        return null;
    return null;
}

From source file:org.eclipse.pde.tools.internal.versioning.ClassFileHelper.java

License:Open Source License

/**
 * Return a class file reader based on the contents of the given URL's input stream.
 * /*from   w  ww  .  jav a 2  s  .com*/
 * @param url location of the class file
 * @return the class file reader or <code>null</code>if any error occurred
 */
private static IClassFileReader getClassReaderFromURL(URL url) {
    try {
        InputStream input = url.openStream();
        try {
            return ToolFactory.createDefaultClassFileReader(input, IClassFileReader.ALL_BUT_METHOD_BODIES);
        } finally {
            if (input != null) {
                input.close();
                input = null;
            }
        }
    } catch (IOException e) {
        //ignore, result will be checked outside
    }
    return null;
}