Example usage for java.io PrintStream toString

List of usage examples for java.io PrintStream toString

Introduction

In this page you can find the example usage for java.io PrintStream toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.expedia.tesla.tools.mojo.CompileMojo.java

@Override
public void execute() throws MojoExecutionException {
    Log log = getLog();/*from   w  w  w .ja  v a  2 s.  c  o  m*/

    log.info("Generating source code from Tesla schemas.");
    log.debug(String.format("language: %s", language));
    log.debug(String.format("outputDir: %s", outputDir));
    log.debug(String.format("classTemplate: %s", classTemplate));
    log.debug(String.format("enumTemplate: %s", enumTemplate));
    log.debug(String.format("serializerTemplate: %s", serializerTemplate));
    log.debug(String.format("generateTypes: %s", generateTypes ? "yes" : "no"));
    PrintStream os = new PrintStream(new ByteArrayOutputStream());
    MapUtils.debugPrint(os, null, extension);
    log.debug(String.format("extension: %s", os.toString()));
    try {
        Compiler compiler = new Compiler();
        compiler.setLanguage(language);
        compiler.setOutputDir(outputDir);
        compiler.setAppSchemaClassName(serializerClassName);
        if (serializerTemplate != null) {
            compiler.setAppSchemaTemplatePath(serializerTemplate.getAbsolutePath());
        }
        compiler.setNotGenerateUserTypes(!generateTypes);
        if (classTemplate != null) {
            compiler.setClassTemplatePath(classTemplate.getAbsolutePath());
        }
        if (enumTemplate != null) {
            compiler.setEnumTemplatePath(enumTemplate.getAbsolutePath());
        }
        compiler.setExtension(extension);
        compiler.setSchemaFiles(getTmlFiles());
        compiler.compile();
    } catch (Exception e) {
        throw new MojoExecutionException("Failed to generate Tesla schema from Java.", e);
    }
    log.info("Generated source code from Tesla schemas successfully.");
}

From source file:axiom.util.Logger.java

/**
 * Create a logger for a PrintStream, such as System.out.
 *//* w  w  w  .j av  a 2s  .  com*/
protected Logger(PrintStream out) {
    init();
    writer = new PrintWriter(out);
    canonicalName = out.toString();

    // create a synchronized list for log entries since different threads may
    // attempt to modify the list at the same time
    entries = Collections.synchronizedList(new LinkedList());
}

From source file:helma.util.Logger.java

/**
 * Create a logger for a PrintStream, such as System.out.
 * @param out the output stream//www .ja  v  a2  s  .co  m
 */
protected Logger(PrintStream out) {
    init();
    writer = new PrintWriter(out);
    canonicalName = out.toString();
}

From source file:net.sourceforge.pmd.benchmark.TextReport.java

@Override
public void generate(Set<RuleDuration> stressResults, PrintStream stream) {

    stream.println("=========================================================");
    stream.println("Rule\t\t\t\t\t\tTime in ms");
    stream.println("=========================================================");

    for (RuleDuration result : stressResults) {
        StringBuilder buffer = new StringBuilder(result.rule.getName());
        while (buffer.length() < TIME_COLUMN) {
            buffer.append(' ');
        }/*from  w w w  .j  ava2s  .c  o m*/
        buffer.append(result.time);
        stream.println(stream.toString());
    }

    stream.println("=========================================================");
}