Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.googlecode.jslint4java.maven;
 
 import java.io.File;
 
Write a report formatted by a com.googlecode.jslint4java.formatter.JSLintResultFormatter to a file. You should call the methods in this order:
  1. open()
  2. report(com.googlecode.jslint4java.JSLintResult)
  3. close()

If you don't call close(), you won't see any output.

public class ReportWriter {
    private final File reportFile;
    private final JSLintResultFormatter formatter;
    private BufferedWriter writer;
    public ReportWriter(File reportFileJSLintResultFormatter formatter) {
        this. = reportFile;
        this. = formatter;
    }

    
End the report.
    public void close() {
        try {
            if (.footer() != null) {
                .write(.footer());
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            IOUtil.close();
        }
    }
    private void ensureReportDirectoryExists() {
        File parent = .getAbsoluteFile().getParentFile();
        if (!parent.exists()) {
            parent.mkdir();
        }
    }

    
The file the report is written to.
    public File getReportFile() {
        return ;
    }

    
Begin the report. Call immediately after construction.
    public void open() {
        try {
             = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(),
                    Charset.forName("UTF-8")));
            if (.header() != null) {
                .write(.header());
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    
Report the result of a run.
    public void report(JSLintResult result) {
        try {
            .write(.format(result));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
New to GrepCode? Check out our FAQ X