Package org.trifort.rootbeer.util

Source Code of org.trifort.rootbeer.util.JimpleWriter

/*
* Copyright 2012 Phil Pratt-Szeliga and other contributors
* http://chirrup.org/
*
* See the file LICENSE for copying permission.
*/

package org.trifort.rootbeer.util;

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import soot.Printer;
import soot.SootClass;
import soot.util.EscapedWriter;

public class JimpleWriter {

  public void write(String filename, SootClass cls) throws Exception {
    OutputStream streamOut = new FileOutputStream(filename);
    PrintWriter writerOut = null;

    writerOut = new PrintWriter(
                new EscapedWriter(new OutputStreamWriter(streamOut)));
    Printer.v().printTo(cls, writerOut);

    writerOut.flush();
    streamOut.close();
  }
 
}
TOP

Related Classes of org.trifort.rootbeer.util.JimpleWriter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.