Home » Core Java » apache » commons » Page 6

commons

Get content of a file line by line

This is an example of how to get the content of a file, line by line. We will make use of the org.apache.commons.io.FileUtils class, that provides file manipulation utilities. Getting the content of a file, line by line implies that you should: Create a new File by converting the pathname string of the file into an abstract pathname. Use readLines(File ...

Read More »

Set content to a file

In this example we shall show you how to set the content to a File. We will make use of the org.apache.commons.io.FileUtils class, that provides file manipulation utilities. To set the content to a File one should perform the following steps: Create a new File by converting the pathname string of the file into an abstract pathname. Create a String ...

Read More »

Get content of a File

With this example we are going to demonstrate how to get the content of a File. We will make use of the org.apache.commons.io.FileUtils class, that provides file manipulation utilities. In short, to get the content of a File you should: Create a new File by converting the pathname string of the file into an abstract pathname. Use readFileToString(File file) API ...

Read More »

touch file using apache commons io example

This is an example of how to touch a file. We will make use of the org.apache.commons.io.FileUtils class, that provides file manipulation utilities. Touching a file implies that you should: Create a new File by converting the pathname string of the file into an abstract pathname. Use lastModified() API method of File that returns the time that the file denoted ...

Read More »