Skip to content

Commit 59423cb

Browse files
committed
feat: create utility init a new File #90 (javadoc)
1 parent eab4800 commit 59423cb

File tree

1 file changed

+22
-0
lines changed
  • fj-core/src/main/java/org/fugerit/java/core/io

1 file changed

+22
-0
lines changed

fj-core/src/main/java/org/fugerit/java/core/io/FileIO.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,32 @@
2828
@Slf4j
2929
public class FileIO {
3030

31+
/**
32+
* Creates a new File from a base dir and file name.
33+
*
34+
* If the baseDir is null, only file name is used.
35+
*
36+
* @param baseDir the parent folder
37+
* @param fileName the file name
38+
* @return the File
39+
*/
3140
public static File newFile( String baseDir, String fileName ) {
3241
return baseDir == null ? new File( fileName ) :new File( baseDir, fileName );
3342
}
3443

44+
/**
45+
* Creates a new File from a base dir and file name.
46+
*
47+
* If the baseDir is null, only file name is used.
48+
*
49+
* Optionally mustAlreadyExists flag can be set.
50+
*
51+
* @param baseDir the parent folder
52+
* @param fileName the file name
53+
* @param mustAlreadyExists true if final file existence should be checked (if the path does not exist a IOException is thrown)
54+
* @return the File
55+
* @throws IOException in case of issues
56+
*/
3557
public static File newFile( String baseDir, String fileName, boolean mustAlreadyExists ) throws IOException {
3658
File file = newFile( baseDir, fileName );
3759
if ( mustAlreadyExists && !file.exists() ) {

0 commit comments

Comments
 (0)