DataBridge Documentation 2.0.17
A Java library for managing database connections and transactions
Loading...
Searching...
No Matches
io.github.kdesp73.databridge.helpers.FileUtils Class Reference

Static Public Member Functions

static List< String > getAbsoluteFilePaths (String directoryPath) throws IOException
 
static List< String > readFile (String filePath)
 
static void writeFile (String filePath, List< String > content) throws IOException
 
static void writeFile (String filePath, String content) throws IOException
 

Detailed Description

Utility class for working with file and directory operations. Provides methods to read, write, and retrieve file paths from a directory.

This class offers static methods for accessing and manipulating files and directories in a Java application, including functionality to read files line-by-line, write content to files, and retrieve absolute paths of files in a specified directory.

Author
KDesp73

Member Function Documentation

◆ getAbsoluteFilePaths()

static List< String > io.github.kdesp73.databridge.helpers.FileUtils.getAbsoluteFilePaths ( String directoryPath) throws IOException
static

Retrieves a list of absolute file paths from a specified directory. Only regular files are included in the list; subdirectories are skipped.

Parameters
directoryPathThe path of the directory from which to retrieve files.
Returns
A list of absolute file paths as strings.
Exceptions
IOExceptionIf the directory path does not exist or is not a directory.

◆ readFile()

static List< String > io.github.kdesp73.databridge.helpers.FileUtils.readFile ( String filePath)
static

Reads the content of a file and returns the lines as a list of strings.

Parameters
filePathThe path of the file to read.
Returns
A list of strings representing the lines in the file, or null if an error occurs.

◆ writeFile() [1/2]

static void io.github.kdesp73.databridge.helpers.FileUtils.writeFile ( String filePath,
List< String > content ) throws IOException
static

Writes a list of strings to a file, each string representing one line of content.

Parameters
filePathThe path of the file to write to.
contentA list of strings to be written to the file.
Exceptions
IOExceptionIf an error occurs while writing the file.

◆ writeFile() [2/2]

static void io.github.kdesp73.databridge.helpers.FileUtils.writeFile ( String filePath,
String content ) throws IOException
static

Writes a single string of content to a file.

Parameters
filePathThe path of the file to write to.
contentThe string content to be written to the file.
Exceptions
IOExceptionIf an error occurs while writing the file.

The documentation for this class was generated from the following file: