Skip to content

Instantly share code, notes, and snippets.

@DirkHoffmann
Created April 28, 2016 14:40
Show Gist options
  • Save DirkHoffmann/c9ecc12eef3027910b793a696fed45f9 to your computer and use it in GitHub Desktop.
Save DirkHoffmann/c9ecc12eef3027910b793a696fed45f9 to your computer and use it in GitHub Desktop.
try {
// Create temp file.
File temp = File.createTempFile("pattern", ".suffix");
// Delete temp file when program exits.
temp.deleteOnExit();
// Write to temp file
BufferedWriter out = new BufferedWriter(new FileWriter(temp));
out.write("aString");
out.close();
} catch (IOException e) {
}
@DirkHoffmann
Copy link
Author

Old code snippet for Java, the equivalent of shell mktemp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment