Create a temporary folder by using the createTempFile() mechanism, deleting the file it creates, and making a folder using the location that was provided. Unlike createTempFile(), there is no minimum size for prefix. If prefix is less than 3 characters, the remaining characters will be filled with
(String prefix, String suffix,
File directory)
| 214 | * filled with underscores |
| 215 | */ |
| 216 | static public File createTempFolder(String prefix, String suffix, |
| 217 | File directory) throws IOException { |
| 218 | int fillChars = 3 - prefix.length(); |
| 219 | for (int i = 0; i < fillChars; i++) { |
| 220 | prefix += '_'; |
| 221 | } |
| 222 | File folder = File.createTempFile(prefix, suffix, directory); |
| 223 | // Now delete that file and create a folder in its place |
| 224 | folder.delete(); |
| 225 | folder.mkdirs(); |
| 226 | // And send the folder back to your friends |
| 227 | return folder; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /** |
no test coverage detected