Package io.github.astrapi69.file.modify
Class ModifyFileExtensions
java.lang.Object
io.github.astrapi69.file.modify.ModifyFileExtensions
The class
ModifyFileExtensions
provides methods for modifying files-
Method Summary
Modifier and TypeMethodDescriptionstatic void
concatenateAll
(List<File> textFiles, File resultTextFile) Concatenates the content of the given list of text files into a single result text filestatic void
modifyFile
(Path inFilePath, FileChangeable modifier) Modifies the input file line by line and writes the modification in the same filestatic void
modifyFile
(Path inFilePath, Charset charsetOfOutputFile, FileChangeable modifier) Modifies the input file line by line and writes the modification in the same filestatic void
modifyFile
(Path inFilePath, Path outFilePath, FileChangeable modifier) Modifies the input file line by line and writes the modification in the new output filestatic void
modifyFile
(Path inFilePath, Path outFilePath, Charset charsetOfOutputFile, FileChangeable modifier) Modifies the input file line by line and writes the modification in the new output file.
-
Method Details
-
concatenateAll
Concatenates the content of the given list of text files into a single result text file- Parameters:
textFiles
- the list of text files to concatenateresultTextFile
- the result text file where the concatenated content will be stored- Throws:
IOException
- if an I/O error occurs during reading from text files or writing to the result text file
-
modifyFile
public static void modifyFile(Path inFilePath, Charset charsetOfOutputFile, FileChangeable modifier) throws IOException Modifies the input file line by line and writes the modification in the same file- Parameters:
inFilePath
- the in file pathcharsetOfOutputFile
- the charset of output filemodifier
- the modifier BiFunction- Throws:
IOException
- Signals that an I/O exception has occurred.
-
modifyFile
Modifies the input file line by line and writes the modification in the same file- Parameters:
inFilePath
- the in file pathmodifier
- the modifier BiFunction- Throws:
IOException
- Signals that an I/O exception has occurred.
-
modifyFile
public static void modifyFile(Path inFilePath, Path outFilePath, Charset charsetOfOutputFile, FileChangeable modifier) throws IOException Modifies the input file line by line and writes the modification in the new output file.- Parameters:
inFilePath
- the in file pathoutFilePath
- the out file pathcharsetOfOutputFile
- the charset of output filemodifier
- the modifier BiFunction- Throws:
IOException
- Signals that an I/O exception has occurred.
-
modifyFile
public static void modifyFile(Path inFilePath, Path outFilePath, FileChangeable modifier) throws IOException Modifies the input file line by line and writes the modification in the new output file- Parameters:
inFilePath
- the in file pathoutFilePath
- the out file pathmodifier
- the modifier BiFunction- Throws:
IOException
- Signals that an I/O exception has occurred.
-