We have already used some methods for finding, creating, reading, and writing files using JCL classes. We had to do it in order to support a demo code of input/output streams. In this section, we are going to talk about file management using JCL in more detail.
The File class from the java.io package represents the underlying filesystem. An object of the File class can be created with one of the following constructors:
- File(String pathname): Creates a new File instance based on the provided pathname
- File(String parent, String child): Creates a new File instance based on the provided parent pathname and a child pathname
- File(File parent, String child): Creates a new File instance based on the provided parent File object and a child pathname
- File(URI uri): Creates a new File instance based on the provided URI object that represents the pathname
We will now see...