o Avoid FileWriter (out of principle and to demonstrate best practices)
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@637253 13f79535-47bb-0310-9956-ffa450edef68master
parent
3ac31bedf7
commit
a70b34c51c
|
|
@ -23,7 +23,9 @@ import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,10 +87,10 @@ public class MyMojo
|
||||||
|
|
||||||
File touch = new File( f, "touch.txt" );
|
File touch = new File( f, "touch.txt" );
|
||||||
|
|
||||||
FileWriter w = null;
|
Writer w = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
w = new FileWriter( touch );
|
w = new OutputStreamWriter( new FileOutputStream( touch ), "UTF-8" );
|
||||||
|
|
||||||
w.write( "touch.txt" );
|
w.write( "touch.txt" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue