Skip to content

Instantly share code, notes, and snippets.

@mickeypash
Created February 5, 2015 21:37
Show Gist options
  • Save mickeypash/02d3572cb0c0a92cb8a6 to your computer and use it in GitHub Desktop.
Save mickeypash/02d3572cb0c0a92cb8a6 to your computer and use it in GitHub Desktop.
Buffered writer in Java
void writeFileBytesBuffered(String filename, String content) {
try {
BufferedWriter writer =
Files.newBufferedWriter(
FileSystems.getDefault().getPath(".", filename),
Charset.forName("US-ASCII"),
StandardOpenOption.CREATE);
writer.write(content, 0, content.length());
}
catch ( IOException ioe ) {
ioe.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment