Skip to content

Instantly share code, notes, and snippets.

@hacksoldier
Last active September 28, 2015 09:09
Show Gist options
  • Select an option

  • Save hacksoldier/c4bc98e2b2f9e2d81882 to your computer and use it in GitHub Desktop.

Select an option

Save hacksoldier/c4bc98e2b2f9e2d81882 to your computer and use it in GitHub Desktop.
public void writeFileOnDisk (String path, String fileName, String csn){
try{
PrintWriter write = new PrintWriter(path + fileName, csn);
write.println("The first line");
write.close();
} catch (IOException ex) {
log.error("Error in writeFileOnDisk", ex);
} finally {
if(write != null)
write.close();
}
}
//call example: writeFileOnDisk ("C:\\dati\\", "fileTest.txt", "UTF-8");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment