Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jruby.runtime.profile;
 
 
 import java.io.File;
 
 
public class ProfileOutput {
  private final PrintStream stream;
  private boolean headerPrinted = false;
  
  public ProfileOutput(PrintStream out) {
    this. = out;
  }
  public ProfileOutput(File outthrows FileNotFoundException {
    this. = new PrintStream(new FileOutputStream(out));
  }
  public void printProfile(ProfilePrinter printer) {
    if () {
      printer.printProfile(false);
    } else {
      printer.printHeader();
      printer.printProfile(true);
       = true;
      footerAndCleanupOnShutdown(printer);
    }
  }
  private void footerAndCleanupOnShutdown(final ProfilePrinter printer) {
    Runtime.getRuntime().addShutdownHook(new Thread() {
      public void run() {
        printer.printFooter();
        .close();
      }
    });
  }
New to GrepCode? Check out our FAQ X