Package io.github.erdos.stencil.impl
Class FileHelper
java.lang.Object
io.github.erdos.stencil.impl.FileHelper
File handling utilities.
Some methods may be called from Clojure core.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FilecreateNonexistentTempFile(File parent, String prefix, String suffix) static FilecreateNonexistentTempFile(String prefix, String suffix) Creates a temporary file that is guaranteed not to exist on file system.static Stringstatic Stringstatic voidforceDelete(File file) Recursively deletes a directory or a file.static voidforceMkdir(File directory) Creates a directory.static StringReturns file name without extension part.
-
Method Details
-
extension
-
extension
-
removeExtension
Returns file name without extension part.- Returns:
- simple file name without extension.
- Throws:
NullPointerException- the input is null
-
createNonexistentTempFile
Creates a temporary file that is guaranteed not to exist on file system.- Parameters:
prefix- file name starts with this filesuffix- file name ends with this file- Returns:
- a new file object pointing to a non-existing file in temp directory.
-
createNonexistentTempFile
-
forceMkdir
Creates a directory. Recursively creates parent directories too.- Parameters:
directory- not null dir to create- Throws:
IOException- on IO errorIllegalArgumentException- when input is null or already exists
-
forceDelete
Recursively deletes a directory or a file.- Parameters:
file- to delete, not null- Throws:
NullPointerException- on null or invalid file
-