Search in sources :

Example 1 with JavaCoreReader

use of com.ibm.dtfj.javacore.parser.j9.JavaCoreReader in project openj9 by eclipse.

the class JCImageFactory method getImage.

/**
 */
public Image getImage(File arg0) throws IOException {
    InputStream stream = new FileInputStream(arg0);
    try {
        Image image = new JavaCoreReader(new ImageBuilderFactory()).generateImage(stream);
        // following cast is safe since examining the code path from generateImage
        // shows that what comes back can only be the JCImage from
        // com.ibm.dtfj.javacore.builder.javacore.ImageBuilder, instance variable _fImage
        ((JCImage) image).setSource(arg0.toURI());
        return image;
    } finally {
        stream.close();
    }
}
Also used : JavaCoreReader(com.ibm.dtfj.javacore.parser.j9.JavaCoreReader) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ImageInputStream(javax.imageio.stream.ImageInputStream) ImageBuilderFactory(com.ibm.dtfj.javacore.builder.javacore.ImageBuilderFactory) Image(com.ibm.dtfj.image.Image) FileInputStream(java.io.FileInputStream)

Example 2 with JavaCoreReader

use of com.ibm.dtfj.javacore.parser.j9.JavaCoreReader in project openj9 by eclipse.

the class JCImageFactory method getImage.

public Image getImage(final ImageInputStream in, URI sourceID) throws IOException {
    InputStream stream = new InputStream() {

        public int read() throws IOException {
            return in.read();
        }
    };
    try {
        Image image = new JavaCoreReader(new ImageBuilderFactory()).generateImage(stream);
        ((JCImage) image).setSource(sourceID);
        return image;
    } finally {
        in.close();
    }
}
Also used : JavaCoreReader(com.ibm.dtfj.javacore.parser.j9.JavaCoreReader) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ImageInputStream(javax.imageio.stream.ImageInputStream) ImageBuilderFactory(com.ibm.dtfj.javacore.builder.javacore.ImageBuilderFactory) Image(com.ibm.dtfj.image.Image)

Aggregations

Image (com.ibm.dtfj.image.Image)2 ImageBuilderFactory (com.ibm.dtfj.javacore.builder.javacore.ImageBuilderFactory)2 JavaCoreReader (com.ibm.dtfj.javacore.parser.j9.JavaCoreReader)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ImageInputStream (javax.imageio.stream.ImageInputStream)2