How to create a temporary file in Java

[CG]BOUGA
1,137 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
1
10
11
12
13
14
15
16
17
18
19
20
// {...}
String prefix = "my-application-name-";
String suffix = "";
// For files
Path file = Files.createTempFile(prefix, suffix);
// For directories
Path directory = Files.createTempDirectory(prefix);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content