Reputation: 25999
I'm basically just doing some tests to figure out a good way to write large amounts of data to a file. I found this great answer Fastest way to write huge data in text file Java and I'm playing around with the script but it seems to be writing to /tmp instead of the directory I'm actually running the program in.
This normally wouldn't bother me, but I'm using EC2 and I've read that the boot storage is not as fast as the ephemeral but because its writing to the boot drive I cannot test if ephemeral is indeed faster or not.
Any suggestions of how to change the temp directory for File?
Upvotes: 2
Views: 2000
Reputation: 9150
Check out the Javadocs for this method of java.io.File:
public static File createTempFile(String prefix,
String suffix,
File directory)
throws IOException
Upvotes: 5