Example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader read

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader read

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader read.

Prototype

public static ClassFileReader read(java.util.zip.ZipFile zip, String filename, boolean fullyInitialize)
            throws ClassFormatException, java.io.IOException 

Source Link

Usage

From source file:org.ant4eclipse.lib.jdt.ecj.internal.tools.loader.JarClassFileImpl.java

License:Open Source License

/**
 * {@inheritDoc}//from w  ww . ja v  a 2s  .  c o m
 */
public final IBinaryType getBinaryType() {
    try {
        return ClassFileReader.read(this._zipFile, this._zipEntryName, true);
    } catch (ClassFormatException e) {
        throw new Ant4EclipseException(e, EcjExceptionCodes.UNABLE_TO_READ_BINARY_TYPE_FROM_JAR_EXCEPTION,
                this._zipFile.getName(), this._zipEntryName);
    } catch (IOException e) {
        throw new Ant4EclipseException(e, EcjExceptionCodes.UNABLE_TO_READ_BINARY_TYPE_FROM_JAR_EXCEPTION,
                this._zipFile.getName(), this._zipEntryName);
    } catch (java.lang.SecurityException e) {
        throw new Ant4EclipseException(e, EcjExceptionCodes.UNABLE_TO_READ_BINARY_TYPE_FROM_JAR_EXCEPTION,
                this._zipFile.getName(), this._zipEntryName);
    }
}

From source file:org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner.java

License:Open Source License

private ClassFileReader getReader(IType type, IClassFile typeRoot)
        throws JavaModelException, ClassFormatException, IOException {
    String className = type.getFullyQualifiedName();
    ClassFileReader newReader = null;/*  w  w w.ja  v a 2  s .  c  o m*/
    byte[] bs = null;

    bs = typeRoot.getBytes();
    return ClassFileReader.read(new ByteArrayInputStream(bs), className, false);
}

From source file:org.z2env.impl.components.java.jdt.NameEnvironmentImpl.java

License:Apache License

private NameEnvironmentAnswer _findType(String slashedClassName) {
    // try as source file first
    File sf = _findSourceFile(slashedClassName);
    if (sf != null) {
        return new NameEnvironmentAnswer(new FileCompilationUnit(sf, this.encoding), null);
    }/* ww w.jav  a  2 s  .c o m*/
    // try as byte array next
    String rn = slashedClassName + ".class";
    InputStream in = this.cl.getResourceAsStream(rn);
    if (in != null) {
        try {
            try {
                return new NameEnvironmentAnswer(ClassFileReader.read(in, rn, true), null);
            } finally {
                in.close();
            }
        } catch (Exception e) {
            if (e instanceof ClassFormatException) {
                int ec = ((ClassFormatException) e).getErrorCode();
                throw new RuntimeException("Failed to read class file (error " + ec + "): " + rn, e);
            }
            throw new RuntimeException("Failed to read class file " + rn, e);
        }
    }
    return null;
}